From cd394cac3f0a84c663f3f2abb283b5b646d0635e Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 26 Jul 2021 09:52:46 +0900 Subject: [PATCH] Fix: Installer - ProfileDir Path --- install.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 31dfb8f..2433a62 100755 --- a/install.sh +++ b/install.sh @@ -475,11 +475,21 @@ check_lepton_ini() { # We should always create a new one, as it also takes into account the possibility of setting it manually. # Updates happen infrequently, so the creation overhead is less significant. +get_profile_dir() { + local profilePath="$1" + for profileDir in "${firefoxProfileDirPaths[@]}"; do + if [[ "${profilePath}" == "${profileDir}"* ]]; then + echo "${profileDir}" + return 0 + fi + done +} + CHROMEINFOFILE="LEPTON" write_lepton_info() { # Init info local output="" - local prevDir=$(dirname "${firefoxProfilePaths[0]}") + local prevDir="$firefoxProfileDirPaths[0]" local latestPath="${firefoxProfilePaths[${#firefoxProfilePaths[@]} - 1]}" for profilePath in "${firefoxProfilePaths[@]}"; do local LEPTONINFOPATH="${profilePath}/chrome/${CHROMEINFOFILE}" @@ -509,7 +519,7 @@ write_lepton_info() { fi # Flushing - local profileDir=$(dirname "${profilePath}") + local profileDir=$(get_profile_dir "${profilePath}") local profileName=$(basename "${profilePath}") if [ "${prevDir}" != "${profileDir}" ]; then write_file "${prevDir}/${LEPTONINFOFILE}" "${output}"