Skip to content

Commit

Permalink
Move check_for_big_files implementation to the same function category
Browse files Browse the repository at this point in the history
For lookup convenience sake.

Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
  • Loading branch information
brlin-tw committed May 8, 2018
1 parent 29d74ee commit 16c4d2b
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/woeusb
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,25 @@ workaround_buggy_motherboards_that_ignore_disks_without_boot_flag_toggled(){
return $?
}; declare -fr workaround_buggy_motherboards_that_ignore_disks_without_boot_flag_toggled

## Check every file in source directory for files bigger than max fat32 file size (~4GB)
check_for_big_files(){
local -r source_fs_mountpoint="${1}"
local IFS_backup=$IFS

IFS=$'\n'
for file in ` find "${source_fs_mountpoint}" -type f `; do
if (( $(stat -c "%s" $file) > 4294967295 )); then # Max fat32 file size is 2^32 - 1 bytes
echo_with_color red "Error: File $file is larger than that supported by the fat32 filesystem. Use NTFS (--target-filesystem NTFS)."
IFS=$IFS_backup
unset IFS_backup
return 1
fi
done
IFS=$IFS_backup
unset IFS_backup
return 0
}; declare -fr check_for_big_files

## Check target partition for potential problems before mounting them for --partition creation mode as we don't know about the existing partition
## target_partition: The target partition to check
## install_mode: The usb storage creation method to be used
Expand Down Expand Up @@ -2011,25 +2030,6 @@ util_check_function_parameters_quantity(){
return 0
}; declare -fr util_check_function_parameters_quantity

## Check every file in source directory for files bigger than max fat32 file size (~4GB)
check_for_big_files(){
local -r source_fs_mountpoint="${1}"
local IFS_backup=$IFS

IFS=$'\n'
for file in ` find "${source_fs_mountpoint}" -type f `; do
if (( $(stat -c "%s" $file) > 4294967295 )); then # Max fat32 file size is 2^32 - 1 bytes
echo_with_color red "Error: File $file is larger than that supported by the fat32 filesystem. Use NTFS (--target-filesystem NTFS)."
IFS=$IFS_backup
unset IFS_backup
return 1
fi
done
IFS=$IFS_backup
unset IFS_backup
return 0
}; declare -fr check_for_big_files

trap trap_exit EXIT
trap trap_errexit ERR
trap trap_interrupt INT
Expand Down

0 comments on commit 16c4d2b

Please sign in to comment.