|
@ -155,10 +155,15 @@ fn_workshop_is_mod_copy_needed(){ |
|
|
|
|
|
|
|
|
fn_workshop_get_mod_name(){ |
|
|
fn_workshop_get_mod_name(){ |
|
|
local modid="$1" |
|
|
local modid="$1" |
|
|
if ! [ -d "${workshopmodsdir}/${modid}" ]; then |
|
|
# Each game has different Steam Workshop structure, so mod id will be stored in a different place |
|
|
echo "$(grep -Po '(?<=name = ").+?(?=")' ${workshopmodsdir}/${modid}/mod.cpp)" |
|
|
if [ "${engine}" == "realvirtuality" ]; then |
|
|
elif ! [ -d "${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}" ]; then |
|
|
if ! [ -d "${workshopmodsdir}/${modid}" ]; then |
|
|
echo "$(grep -Po '(?<=name = ").+?(?=")' ${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}/mod.cpp)" |
|
|
echo "$(grep -Po '(?<=name = ").+?(?=")' ${workshopmodsdir}/${modid}/mod.cpp)" |
|
|
|
|
|
elif ! [ -d "${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}" ]; then |
|
|
|
|
|
echo "$(grep -Po '(?<=name = ").+?(?=")' ${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}/mod.cpp)" |
|
|
|
|
|
else |
|
|
|
|
|
echo "$(fn_workshop_get_name_from_steam ${modid})" |
|
|
|
|
|
fi |
|
|
else |
|
|
else |
|
|
echo "$(fn_workshop_get_name_from_steam ${modid})" |
|
|
echo "$(fn_workshop_get_name_from_steam ${modid})" |
|
|
fi |
|
|
fi |
|
@ -179,45 +184,29 @@ fn_workshop_lowercase() { |
|
|
filesupperwc=$(find "${workshopmodsdir}/" -name '*[[:upper:]]*' | wc -l) |
|
|
filesupperwc=$(find "${workshopmodsdir}/" -name '*[[:upper:]]*' | wc -l) |
|
|
fn_script_log_info "Found ${filesupperwc} uppercase files out of ${fileswc}, converting" |
|
|
fn_script_log_info "Found ${filesupperwc} uppercase files out of ${fileswc}, converting" |
|
|
echo -en "Found ${filesupperwc} uppercase files out of ${fileswc}, converting..." |
|
|
echo -en "Found ${filesupperwc} uppercase files out of ${fileswc}, converting..." |
|
|
# Works but not on folders |
|
|
|
|
|
# while IFS= read -r -d '' file; do |
|
|
|
|
|
# mv -b -- "$file" "${file,,}" 2>/dev/null |
|
|
|
|
|
# done < <(find ${workshopmodsdir} -depth -name '*[A-Z]*' -print0) |
|
|
|
|
|
# while IFS= read -r -d '' file; do |
|
|
|
|
|
# mv -b -- "$file" "${file,,}" 2>/dev/null |
|
|
|
|
|
# done < <(find ${workshopmodsdir}/ -depth -name '*[A-Z]*' -print0) |
|
|
|
|
|
|
|
|
|
|
|
# Works bu not on WSL? |
|
|
|
|
|
# https://unix.stackexchange.com/questions/20222/change-entire-directory-tree-to-lower-case-names/20232#20232 |
|
|
|
|
|
# |
|
|
# |
|
|
find ${workshopmodsdir} -depth -exec sh -c ' |
|
|
# Coudln't get this to work on WSL. Needs to be verified on an acutal linux server. |
|
|
t=${0%/*}/$(printf %s "${0##*/}" | tr "[:upper:]" "[:lower:]"); |
|
|
|
|
|
[ "$t" = "$0" ] || mv -i "$0" "$t" |
|
|
|
|
|
' {} \; |
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
# Coudln't get this to work. |
|
|
|
|
|
# |
|
|
# |
|
|
# Convert files and directories starting from the deepest to prevent issues (-depth argument) |
|
|
# Convert files and directories starting from the deepest to prevent issues (-depth argument) |
|
|
# while IFS= read -r -d '' src; do |
|
|
while IFS= read -r -d '' src; do |
|
|
# # We have to convert only the last file from the path, otherwise we will fail to convert anything if a parent dir has any uppercase |
|
|
# We have to convert only the last file from the path, otherwise we will fail to convert anything if a parent dir has any uppercase |
|
|
# # therefore, we have to separate the end of the filename to only lowercase it rather than the whole line |
|
|
# therefore, we have to separate the end of the filename to only lowercase it rather than the whole line |
|
|
# # Gather parent dir, filename lowercase filename, and set lowercase destination name |
|
|
# Gather parent dir, filename lowercase filename, and set lowercase destination name |
|
|
# latestparentdir=$(dirname "${src}") |
|
|
latestparentdir=$(dirname "${src}") |
|
|
# latestfilelc=$(basename "${src}" | tr '[:upper:]' '[:lower:]') |
|
|
latestfilelc=$(basename "${src}" | tr '[:upper:]' '[:lower:]') |
|
|
# dst="${latestparentdir}/${latestfilelc}" |
|
|
dst="${latestparentdir}/${latestfilelc}" |
|
|
# # Only convert if destination does not already exist for some reason |
|
|
# Only convert if destination does not already exist for some reason |
|
|
# if [ ! -e "${dst}" ]; then |
|
|
if [ ! -e "${dst}" ]; then |
|
|
# # Finally we can rename the file |
|
|
# Finally we can rename the file |
|
|
# mv "${src}" "${dst}" |
|
|
mv "${src}" "${dst}" |
|
|
# # Exit if it fails for any reason |
|
|
# Exit if it fails for any reason |
|
|
# local exitcode=$? |
|
|
local exitcode=$? |
|
|
# if [ "${exitcode}" != 0 ]; then |
|
|
if [ "${exitcode}" != 0 ]; then |
|
|
# fn_print_fail_eol_nl |
|
|
fn_print_fail_eol_nl |
|
|
# core_exit.sh |
|
|
core_exit.sh |
|
|
# fi |
|
|
fi |
|
|
# fi |
|
|
fi |
|
|
# done < <(find "${workshopmodsdir}" -depth -name '*[[:upper:]]*' -print0) |
|
|
done < <(find "${workshopmodsdir}" -depth -name '*[[:upper:]]*' -print0) |
|
|
fn_print_ok_eol_nl |
|
|
fn_print_ok_eol_nl |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
@ -255,17 +244,6 @@ fn_workshop_copy_destination() { |
|
|
else |
|
|
else |
|
|
echo "Mod ${modname} is already in mods folder." |
|
|
echo "Mod ${modname} is already in mods folder." |
|
|
fi |
|
|
fi |
|
|
# echo -en "copying ${modprettyname} to ${modinstalldir}..." |
|
|
|
|
|
# fn_sleep_time |
|
|
|
|
|
# cp -Rf "${extractdir}/." "${modinstalldir}/" |
|
|
|
|
|
# local exitcode=$? |
|
|
|
|
|
# if [ "${exitcode}" != 0 ]; then |
|
|
|
|
|
# fn_print_fail_eol_nl |
|
|
|
|
|
# fn_script_log_fatal "Copying ${modprettyname} to ${modinstalldir}" |
|
|
|
|
|
# else |
|
|
|
|
|
# fn_print_ok_eol_nl |
|
|
|
|
|
# fn_script_log_pass "Copying ${modprettyname} to ${modinstalldir}" |
|
|
|
|
|
# fi |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# ## Directory management. |
|
|
# ## Directory management. |
|
|