Skip to content

Commit

Permalink
init: fixed output path determination error
Browse files Browse the repository at this point in the history
There was an error determining the output path where if the given
path is only a filepath (without directory), the program will try
to use the original input filename as a directory and cause the
upscaling process to be unreasonably failed. Hence, we need to fix
this bug.

This patch fixes the output path determination error in init/
directory.

Co-authored-by: Shuralyov, Jean <jean.shuralyov@proton.me>
Co-authored-by: Galyna, Cory <cory.galyna@gmail.com>
Co-authored-by: (Holloway) Chew, Kean Ho <hollowaykeanho@gmail.com>
Signed-off-by: (Holloway) Chew, Kean Ho <hollowaykeanho@gmail.com>
  • Loading branch information
3 people committed Mar 3, 2024
1 parent 9ba0c87 commit bed4aa7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion init/services/compilers/upscaler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ function UPSCALER-Output-Filename-Image {

# execute
$___output = FS-Extension-Remove "$(Split-Path -Leaf -Path "${___input}")" "*"
$___output = "$(Split-Path -Parent -Path "${___input}")\${___output}-upscaled"
if ($(Split-Path -Parent -Path "${___input}") -ne "${___input}") {
$___output = "$(Split-Path -Parent -Path "${___input}")\${___output}-upscaled"
} else {
$___output = ".\${___output}-upscaled"
}

switch ($___format) {
"jpg" {
Expand Down
6 changes: 5 additions & 1 deletion init/services/compilers/upscaler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ UPSCALER_Output_Filename_Image() {

# execute
___output="$(FS_Extension_Remove "${2##*/}" "*")"
___output="${2%/*}/${___output}-upscaled"
if [ ! "${2%/*}" = "$2" ]; then
___output="${2%/*}/${___output}-upscaled"
else
___output="./${___output}-upscaled"
fi

case "$3" in
jpg)
Expand Down

0 comments on commit bed4aa7

Please sign in to comment.