better backup system

This commit is contained in:
Roy 2024-06-20 16:30:59 -07:00 committed by GitHub
parent 7b5c539982
commit 701b476dd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2359,23 +2359,13 @@ if [[ -n "$userdata_folder" ]]; then
# Check if shortcuts_vdf_path is not empty # Check if shortcuts_vdf_path is not empty
if [[ -n "$shortcuts_vdf_path" ]]; then if [[ -n "$shortcuts_vdf_path" ]]; then
# Create backup of shortcuts.vdf file # Create backup of shortcuts.vdf file
cp "$shortcuts_vdf_path" "$shortcuts_vdf_path.bak" cp "$shortcuts_vdf_path" "$shortcuts_vdf_path.bak_$(date +%Y%m%d_%H%M%S)"
else else
# Find config directory for current user # Find or create config directory for current user
config_dir=$(find "$userdata_folder" -maxdepth 1 -type d -name config) config_dir=$(find "$userdata_folder" -maxdepth 1 -type d -name config || mkdir -p "$userdata_folder/config/" && echo "$userdata_folder/config/")
# Check if config_dir is not empty # Create new shortcuts.vdf file at expected location for current user
if [[ -n "$config_dir" ]]; then touch "$config_dir/shortcuts.vdf"
# Create new shortcuts.vdf file at expected location for current user
touch "$config_dir/shortcuts.vdf"
shortcuts_vdf_path="$config_dir/shortcuts.vdf"
else
# Create new config directory and new shortcuts.vdf file at expected location for current user
mkdir "$userdata_folder/config/"
touch "$userdata_folder/config/shortcuts.vdf"
config_dir="$userdata_folder/config/"
shortcuts_vdf_path="$config_dir/shortcuts.vdf"
fi
fi fi
else else
# Userdata folder was not found # Userdata folder was not found