|
1 | 1 | import std/[logging, os, strutils] |
| 2 | +import ./envparser |
2 | 3 |
|
3 | 4 | const |
4 | 5 | MimeTemplate = |
@@ -36,26 +37,29 @@ Exec=$1 shell |
36 | 37 | """ |
37 | 38 |
|
38 | 39 | proc ensureDirsExist*(): string {.sideEffect.} = |
39 | | - var buf = newStringOfCap(32) |
40 | | - buf &= getHomeDir() |
| 40 | + if equinoxBin.len < 1: |
| 41 | + var buf = newStringOfCap(32) |
| 42 | + buf &= getHomeDir() |
41 | 43 |
|
42 | | - for path in [".local", "share", "applications"]: |
43 | | - buf &= '/' & path |
44 | | - discard existsOrCreateDir(buf) |
| 44 | + for path in [".local", "share", "applications"]: |
| 45 | + buf &= '/' & path |
| 46 | + discard existsOrCreateDir(buf) |
45 | 47 |
|
46 | | - ensureMove(buf) |
| 48 | + return ensureMove(buf) |
47 | 49 |
|
48 | 50 | proc createMimeHandlerEntry*() = |
49 | | - debug "desktop_files: creating MIME handler entry" |
50 | | - writeFile( |
51 | | - ensureDirsExist() / "equinox-mime.desktop", MimeTemplate % [getAppFilename()] |
52 | | - ) |
| 51 | + if equinoxBin.len < 1: |
| 52 | + debug "desktop_files: creating MIME handler entry" |
| 53 | + writeFile( |
| 54 | + ensureDirsExist() / "equinox-mime.desktop", MimeTemplate % [getAppFilename()] |
| 55 | + ) |
53 | 56 |
|
54 | 57 | proc createDesktopEntries*() = |
55 | | - debug "desktop_files: creating desktop entry for equinox" |
56 | | - writeFile( |
57 | | - ensureDirsExist() / "equinox.desktop", DesktopEntryTemplate % [getAppFilename()] |
58 | | - ) |
59 | | - writeFile( |
60 | | - ensureDirsExist() / "equinox_shell.desktop", DesktopEntryShell % [getAppFilename()] |
61 | | - ) |
| 58 | + if equinoxBin.len < 1: |
| 59 | + debug "desktop_files: creating desktop entry for equinox" |
| 60 | + writeFile( |
| 61 | + ensureDirsExist() / "equinox.desktop", DesktopEntryTemplate % [getAppFilename()] |
| 62 | + ) |
| 63 | + writeFile( |
| 64 | + ensureDirsExist() / "equinox_shell.desktop", DesktopEntryShell % [getAppFilename()] |
| 65 | + ) |
0 commit comments