@@ -30,7 +30,6 @@ fastdlclientlist="${tmpdir}/fastdl_files_client.txt"
3030fastdlupdatelist=" ${tmpdir} /fastdl_files_to_update.txt"
3131fastdlremovelist=" ${tmpdir} /fastdl_files_to_remove.txt"
3232fastdlcompresslist=" ${tmpdir} /fastdl_files_to_compress.txt"
33- # Source clients will not download a compressed file larger than 150 MB.
3433fastdlmaxcompresssize=" 157286400"
3534
3635# Header
@@ -64,7 +63,7 @@ if [ "${shortname}" == "gmod" ]; then
6463 fn_script_log_info " Force clients to download files: YES"
6564 else
6665 luaresource=" off"
67- fn_script_log_info " Force clients to download filesr : NO"
66+ fn_script_log_info " Force clients to download files : NO"
6867 fi
6968fi
7069
@@ -215,7 +214,7 @@ fn_fastdl_gather() {
215214 done
216215}
217216
218- # Adds Garry's Mod files to the file list, mapping addons and lua content to the path clients request .
217+ # Adds Garry's Mod files to the file list.
219218fn_fastdl_gather_gmod () {
220219 cd " ${systemdir} " || exit
221220 allowed_extentions_array=(" *.ain" " *.bsp" " *.mdl" " *.mp3" " *.ogg" " *.otf" " *.pcf" " *.phy" " *.png" " *.svg" " *.vtf" " *.vmt" " *.vtx" " *.vvd" " *.ttf" " *.wav" )
@@ -253,7 +252,6 @@ fn_fastdl_gather_gmod() {
253252
254253# Works out which files need to be copied, compressed or removed.
255254fn_fastdl_plan () {
256- # When the same path is found more than once, the entry with the lowest priority value is kept.
257255 LC_ALL=C sort -t $' \t ' -k2,2 -k1,1 " ${fastdlfilelist} " | awk -F ' \t' -v dupes=" ${fastdlduplicatelist} " ' seen[$2]++ { print $5 " > " $2 > dupes; next } { print }' > " ${fastdlfilelist} .sorted"
258256 mv -f " ${fastdlfilelist} .sorted" " ${fastdlfilelist} "
259257 if [ -f " ${fastdlduplicatelist} " ]; then
@@ -263,12 +261,11 @@ fn_fastdl_plan() {
263261 done < " ${fastdlduplicatelist} "
264262 fi
265263
266- # The record lists each file this instance wrote to the fastdl directory and the source it came from.
267264 declare -A fastdlrecordsource=()
268265 declare -A fastdlexpected=()
269266 if [ " ${fastdlrebuild} " != " on" ] && [ -f " ${fastdlrecord} " ] && [ " $( head -n 1 " ${fastdlrecord} " ) " == " ${fastdldir} " ]; then
270267 while IFS=$' \t ' read -r fastdltarget recordsource; do
271- fastdlrecordsource[" ${fastdltarget} " ]=" ${recordsource} "
268+ [ -n " ${fastdltarget} " ] && fastdlrecordsource[" ${fastdltarget} " ]=" ${recordsource} "
272269 done < <( tail -n +2 " ${fastdlrecord} " )
273270 fi
274271 echo " ${fastdldir} " > " ${fastdlnewrecord} "
@@ -310,7 +307,6 @@ fn_fastdl_plan() {
310307 fi
311308 done < " ${fastdlfilelist} "
312309
313- # Only files this instance wrote are removed, anything else in the fastdl directory is left alone.
314310 for fastdltarget in " ${! fastdlrecordsource[@]} " ; do
315311 if [ -z " ${fastdlexpected["${fastdltarget}"]} " ] && [ -f " ${fastdldir} /${fastdltarget} " ]; then
316312 echo " ${fastdltarget} " >> " ${fastdlremovelist} "
@@ -353,7 +349,6 @@ fn_fastdl_preview() {
353349 else
354350 fastdl_directories_array=(" maps" " materials" " models" " particles" " sound" " resource" )
355351 fi
356- # Source loads content from custom/<name>/ folders as if it were in the game folder.
357352 fastdl_custom_array=()
358353 if [ " ${engine} " == " source" ] && [ -d " ${systemdir} /custom" ]; then
359354 while IFS= read -r -d ' ' customdir; do
@@ -511,7 +506,7 @@ fn_fastdl_gmod_dl_enforcer() {
511506 fi
512507}
513508
514- # Compresses Fastdl files using bzip2, one process per CPU core .
509+ # Compresses Fastdl files using bzip2.
515510fn_fastdl_bzip2 () {
516511 if [ -s " ${fastdlcompresslist} " ]; then
517512 fastdlthreads=" $( nproc) "
@@ -540,7 +535,7 @@ fn_fastdl_bzip2() {
540535 fi
541536}
542537
543- # Saves the list of files this instance wrote, used to find changed and removed files on the next run .
538+ # Saves the list of files written to the fastdl directory .
544539fn_fastdl_record () {
545540 fn_print " saving Fastdl file record ${fastdlrecord} "
546541 mkdir -p " ${datadir} " && mv -f " ${fastdlnewrecord} " " ${fastdlrecord} "
0 commit comments