-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add legendary to before each command
- Loading branch information
Showing
5 changed files
with
28 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,7 @@ | ||
import { homedir, platform } from "os"; | ||
import path from "path"; | ||
import { isPackaged } from 'electron-is-packaged'; | ||
|
||
const isProd = process.env.NODE_ENV === "production"; | ||
const isWindows = platform() === "win32"; | ||
const getLegendaryBin = () => { | ||
const fixAsar = (str: string) => { | ||
if(!str.includes("app.asar.unpacked")) { | ||
return str.replace("app.asar", "app.asar.unpacked"); | ||
} | ||
|
||
return str; | ||
}; | ||
|
||
const binariesPath = | ||
isProd && isPackaged // the path to a bundled electron app. | ||
? path.join(process.resourcesPath, '/app.asar.unpacked', '/app', '/bin', platform()) | ||
: path.join(process.cwd(), '/renderer', '/public', '/bin', platform()); | ||
|
||
return fixAsar(path.resolve( | ||
path.join(binariesPath, isWindows ? "/legendary.exe" : "/legendary") | ||
)); | ||
} | ||
|
||
const LegendaryConstants = { | ||
configFilePath: `${homedir()}/.config/legendary`, | ||
bin: getLegendaryBin(), | ||
}; | ||
|
||
export default LegendaryConstants; |