Skip to content

Commit

Permalink
old save function back
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Dec 25, 2024
1 parent 9cd9cef commit 465a4b6
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions functions/helperFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -429,26 +429,30 @@ function getReleaseURLGH(){
}

function linkToSaveFolder(){
local emu=$1 # /saves/$emu/
local folderName=$2 # states or saves
local path=$3 # original location

mkdir -p "$path"
local emu=$1
local folderName=$2
local path=$3

# Es el path un simlink?
if [ ! -L "$path" ]; then
#We delete the old symlink and move the saves
if [ -L "$savesPath/$emu/$folderName" ]; then
if [ ! -d "$savesPath/$emu/$folderName" ]; then
if [ ! -L "$savesPath/$emu/$folderName" ]; then
mkdir -p "$savesPath/$emu"
setMSG "Linking $emu $folderName to the Emulation/saves folder"
rm -rf "$savesPath/$emu/$folderName"
mv "$path" "$savesPath/$emu/$folderName"
ln -snv "$savesPath/$emu/$folderName" "$path"
mkdir -p "$path"
ln -snv "$path" "$savesPath/$emu/$folderName"
fi
else
setMSG "Rebuilding Link $emu $folderName to the Emulation/saves folder"
mkdir -p "$savesPath/$emu/$folderName"
unlink "$savesPath/$emu/$folderName"
ln -snv "$savesPath/$emu/$folderName" "$path"
if [ ! -L "$savesPath/$emu/$folderName" ]; then
echo "$savesPath/$emu/$folderName is not a link. Please check it."
else
if [ $(readlink $savesPath/$emu/$folderName) == $path ]; then
echo "$savesPath/$emu/$folderName is already linked."
echo " Target: $(readlink $savesPath/$emu/$folderName)"
else
echo "$savesPath/$emu/$folderName not linked correctly."
unlink "$savesPath/$emu/$folderName"
linkToSaveFolder "$emu" "$folderName" "$path"
fi
fi
fi

}
Expand Down

0 comments on commit 465a4b6

Please sign in to comment.