Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6e5f93

Browse files
committed
Fix a double slash issue
1 parent 386dea3 commit c6e5f93

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

AffinityScripts/AffinityDesigner.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ print_step "Creating custom desktop entry..."
566566
desktop_file="$HOME/.local/share/applications/AffinityDesigner.desktop"
567567
mkdir -p "$HOME/.local/share/applications"
568568

569+
# Normalize directory path (remove trailing slash if present)
570+
directory="${directory%/}"
571+
569572
{
570573
echo "[Desktop Entry]"
571574
echo "Name=Affinity Designer"

AffinityScripts/AffinityLinuxInstaller.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,14 +2166,20 @@ def create_custom_desktop_entry(self, installer_path, app_name):
21662166

21672167
wine = Path(self.directory) / "ElementalWarriorWine" / "bin" / "wine"
21682168

2169+
# Normalize all paths to strings to avoid double slashes
2170+
wine_str = str(wine)
2171+
directory_str = str(self.directory).rstrip("/") # Remove trailing slash if present
2172+
exe_path_normalized = exe_path.replace("\\", "/") # Normalize Windows paths
2173+
21692174
with open(desktop_file, "w") as f:
21702175
f.write("[Desktop Entry]\n")
21712176
f.write(f"Name={app_name}\n")
21722177
f.write(f"Comment={app_name} installed via Affinity Linux Installer\n")
21732178
if icon_path:
2174-
f.write(f"Icon={icon_path}\n")
2175-
f.write(f"Path={self.directory}\n")
2176-
f.write(f'Exec=env WINEPREFIX={self.directory} {wine} "{exe_path}"\n')
2179+
icon_path_str = str(icon_path).rstrip("/")
2180+
f.write(f"Icon={icon_path_str}\n")
2181+
f.write(f"Path={directory_str}\n")
2182+
f.write(f'Exec=env WINEPREFIX={directory_str} {wine_str} "{exe_path_normalized}"\n')
21772183
f.write("Terminal=false\n")
21782184
f.write("Type=Application\n")
21792185
f.write("Categories=Application;\n")
@@ -2517,13 +2523,19 @@ def create_desktop_entry(self, app_name):
25172523
app_path = Path(self.directory) / "drive_c" / "Program Files" / "Affinity" / dir_name / exe
25182524
icon_path = Path.home() / ".local" / "share" / "icons" / icon
25192525

2526+
# Normalize all paths to strings to avoid double slashes
2527+
wine_str = str(wine)
2528+
app_path_str = str(app_path).replace("\\", "/") # Ensure forward slashes for Windows paths in Wine
2529+
directory_str = str(self.directory).rstrip("/") # Remove trailing slash if present
2530+
icon_path_str = str(icon_path)
2531+
25202532
with open(desktop_file, "w") as f:
25212533
f.write("[Desktop Entry]\n")
25222534
f.write(f"Name=Affinity {name}\n")
25232535
f.write(f"Comment=A powerful {name.lower()} software.\n")
2524-
f.write(f"Icon={icon_path}\n")
2525-
f.write(f"Path={self.directory}\n")
2526-
f.write(f'Exec=env WINEPREFIX={self.directory} {wine} "{app_path}"\n')
2536+
f.write(f"Icon={icon_path_str}\n")
2537+
f.write(f"Path={directory_str}\n")
2538+
f.write(f'Exec=env WINEPREFIX={directory_str} {wine_str} "{app_path_str}"\n')
25272539
f.write("Terminal=false\n")
25282540
f.write("Type=Application\n")
25292541
f.write("Categories=Graphics;\n")

AffinityScripts/AffinityLinuxInstaller.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,17 @@ create_desktop_entry() {
656656
local app_path=$2
657657
local icon_path=$3
658658
local desktop_file="$HOME/.local/share/applications/Affinity$app_name.desktop"
659+
# Normalize paths to avoid double slashes
660+
local directory="${HOME}/.AffinityLinux"
661+
directory="${directory%/}"
662+
app_path="${app_path//\\/\/}" # Normalize Windows paths
659663

660664
echo "[Desktop Entry]" > "$desktop_file"
661665
echo "Name=Affinity $app_name" >> "$desktop_file"
662666
echo "Comment=A powerful $app_name software." >> "$desktop_file"
663667
echo "Icon=$icon_path" >> "$desktop_file"
664-
echo "Path=$HOME/.AffinityLinux" >> "$desktop_file"
665-
echo "Exec=env WINEPREFIX=$HOME/.AffinityLinux $HOME/.AffinityLinux/ElementalWarriorWine/bin/wine \"$app_path\"" >> "$desktop_file"
668+
echo "Path=$directory" >> "$desktop_file"
669+
echo "Exec=env WINEPREFIX=$directory $directory/ElementalWarriorWine/bin/wine \"$app_path\"" >> "$desktop_file"
666670
echo "Terminal=false" >> "$desktop_file"
667671
echo "NoDisplay=false" >> "$desktop_file"
668672
echo "StartupWMClass=${app_name,,}.exe" >> "$desktop_file"
@@ -676,6 +680,8 @@ create_all_in_one_desktop_entry() {
676680
local icon_path=$1
677681
local desktop_file="$HOME/.local/share/applications/Affinity.desktop"
678682
local directory="$HOME/.AffinityLinux"
683+
# Normalize directory path (remove trailing slash if present)
684+
directory="${directory%/}"
679685

680686
echo "[Desktop Entry]" > "$desktop_file"
681687
echo "Name=Affinity" >> "$desktop_file"

AffinityScripts/AffinityPhoto.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ print_step "Creating custom desktop entry..."
565565
desktop_file="$HOME/.local/share/applications/AffinityPhoto.desktop"
566566
mkdir -p "$HOME/.local/share/applications"
567567
568+
# Normalize directory path (remove trailing slash if present)
569+
directory="${directory%/}"
570+
568571
{
569572
echo "[Desktop Entry]"
570573
echo "Name=Affinity Photo"

AffinityScripts/AffinityPublisher.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ print_step "Creating custom desktop entry..."
566566
desktop_file="$HOME/.local/share/applications/AffinityPublisher.desktop"
567567
mkdir -p "$HOME/.local/share/applications"
568568

569+
# Normalize directory path (remove trailing slash if present)
570+
directory="${directory%/}"
571+
569572
{
570573
echo "[Desktop Entry]"
571574
echo "Name=Affinity Publisher"

AffinityScripts/Affinityv3.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,9 @@ print_step "Creating custom desktop entry..."
570570
desktop_file="$HOME/.local/share/applications/Affinity.desktop"
571571
mkdir -p "$HOME/.local/share/applications"
572572

573+
# Normalize directory path (remove trailing slash if present)
574+
directory="${directory%/}"
575+
573576
{
574577
echo "[Desktop Entry]"
575578
echo "Name=Affinity Affinity"

0 commit comments

Comments
 (0)