mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Fix desktop shortcuts
This commit is contained in:
parent
0d3274b1a4
commit
5444bc785f
2 changed files with 9 additions and 8 deletions
|
@ -18,7 +18,7 @@ public class DesktopShortcuts {
|
|||
set "SHORTCUT=%%HOMEDRIVE%%%%HOMEPATH%%\\Desktop\\%s.lnk"
|
||||
set PWS=powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile
|
||||
|
||||
%%PWS%% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%%SHORTCUT%%'); $S.IconLocation='%s'; $S.TargetPath = '%%TARGET%%'; $S.Arguments = '%s'; $S.Save()"
|
||||
%%PWS%% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%%SHORTCUT%%'); $S.IconLocation='%s'; $S.WindowStyle=7; $S.TargetPath = '%%TARGET%%'; $S.Arguments = 'open %s'; $S.Save()"
|
||||
""",
|
||||
shortcutTarget, name, icon.toString(), target);
|
||||
LocalStore.getShell().executeSimpleCommand(content);
|
||||
|
@ -51,7 +51,7 @@ public class DesktopShortcuts {
|
|||
var content = String.format(
|
||||
"""
|
||||
#!/bin/bash
|
||||
"%s" %s
|
||||
"%s" open %s
|
||||
""",
|
||||
exec, target);
|
||||
|
||||
|
|
|
@ -125,6 +125,8 @@ public class XPipeInstallation {
|
|||
|
||||
public static String getLocalInstallationBasePathForCLI(String cliExecutable) throws Exception {
|
||||
var defaultInstallation = getLocalDefaultInstallationBasePath(true);
|
||||
|
||||
// Can be empty in development mode
|
||||
if (cliExecutable == null) {
|
||||
return defaultInstallation;
|
||||
}
|
||||
|
@ -133,14 +135,13 @@ public class XPipeInstallation {
|
|||
return defaultInstallation;
|
||||
}
|
||||
|
||||
if (FileNames.startsWith(cliExecutable, defaultInstallation)) {
|
||||
return defaultInstallation;
|
||||
}
|
||||
|
||||
var path = Path.of(cliExecutable);
|
||||
if (OsType.getLocal().equals(OsType.MACOS)) {
|
||||
return FileNames.getParent(FileNames.getParent(FileNames.getParent(cliExecutable)));
|
||||
return path.getParent().getParent().getParent().toString();
|
||||
} else if (OsType.getLocal().equals(OsType.LINUX)) {
|
||||
return path.getParent().getParent().getParent().toString();
|
||||
} else {
|
||||
return FileNames.getParent(FileNames.getParent(cliExecutable));
|
||||
return path.getParent().getParent().getParent().toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue