Skip to content

Commit

Permalink
fix: 初期プロジェクトファイルパスの取得ロジックを修正し、無効なファイルパスの返却を防止
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Feb 11, 2025
1 parent ceeae15 commit 5be809f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ if (!isMac) {
}

let initialFilePath: string | undefined = undefined;
let initialProjectFilePath: string | undefined = undefined;

if (!isMac) {
initialFilePath = argv[0];
Expand Down Expand Up @@ -376,7 +375,14 @@ registerIpcMainHandle<IpcMainHandle>({
},

GET_INITIAL_PROJECT_FILE_PATH: async () => {
return initialProjectFilePath;
if (
initialFilePath &&
fs.existsSync(initialFilePath) &&
fs.statSync(initialFilePath).isFile() &&
initialFilePath.endsWith(".vvproj")
) {
return initialFilePath;
}
},

/**
Expand Down Expand Up @@ -868,12 +874,6 @@ void app.whenReady().then(async () => {
reloadNeeded: false,
});
}
} else if (
fs.existsSync(initialFilePath) &&
fs.statSync(initialFilePath).isFile() &&
initialFilePath.endsWith(".vvproj")
) {
initialProjectFilePath = initialFilePath;
}
}

Expand Down

0 comments on commit 5be809f

Please sign in to comment.