소스 검색

修复bug ,日志查看bug

hl 11 달 전
부모
커밋
6dc8ce5534
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      src/utils/file.js

+ 3 - 3
src/utils/file.js

@@ -112,13 +112,13 @@ function getLastFile(dirPath, number, callback) {
 // 读取日志(倒叙)指定行数
 function readLastNLines(dirPath, filePathList, n) {
     const fileList = filePathList.map((item) => {
-        var path = dirPath + "/" + item
+        var filepath = dirPath + "/" + item
         // 将相对路径转换为绝对路径
-        const directoryPath = path.resolve(path);
+        const directoryPath = path.resolve(filepath);
         logger.info("日志文件:" + directoryPath)
         let lines = [""]
         if (checkFilePath(directoryPath)) {
-            const content = fs.readFileSync(`${directoryPath}`, "utf8");
+            const content = fs.readFileSync(`${filepath}`, "utf8");
             lines = content.trim().split("\n");
         }
         return {