From a0745e2196606287dcafc40b73a0eba688d516b5 Mon Sep 17 00:00:00 2001 From: K4YT3X Date: Sat, 13 Jun 2020 06:26:27 -0400 Subject: [PATCH] made all drivers change cwd to binary's parent directory to resolve fnf issues --- src/wrappers/anime4kcpp.py | 4 ++++ src/wrappers/realsr_ncnn_vulkan.py | 4 ++++ src/wrappers/srmd_ncnn_vulkan.py | 4 ++++ src/wrappers/waifu2x_caffe.py | 4 ++++ src/wrappers/waifu2x_converter_cpp.py | 4 ++-- src/wrappers/waifu2x_ncnn_vulkan.py | 4 ++++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/wrappers/anime4kcpp.py b/src/wrappers/anime4kcpp.py index d35815d..a8de0d2 100755 --- a/src/wrappers/anime4kcpp.py +++ b/src/wrappers/anime4kcpp.py @@ -84,6 +84,10 @@ class WrapperMain: height {int} -- output video height """ + # change the working directory to the binary's parent directory + # so the binary can find shared object files and other files + os.chdir(pathlib.Path(self.driver_settings['path']).parent) + # overwrite config file settings self.driver_settings['input'] = input_file self.driver_settings['output'] = output_file diff --git a/src/wrappers/realsr_ncnn_vulkan.py b/src/wrappers/realsr_ncnn_vulkan.py index f49ffa6..2b81eb3 100755 --- a/src/wrappers/realsr_ncnn_vulkan.py +++ b/src/wrappers/realsr_ncnn_vulkan.py @@ -65,6 +65,10 @@ class WrapperMain: ratio {int} -- output video ratio """ + # change the working directory to the binary's parent directory + # so the binary can find shared object files and other files + os.chdir(pathlib.Path(self.driver_settings['path']).parent) + # overwrite config file settings self.driver_settings['i'] = input_directory self.driver_settings['o'] = output_directory diff --git a/src/wrappers/srmd_ncnn_vulkan.py b/src/wrappers/srmd_ncnn_vulkan.py index 8fe6749..2c2584f 100755 --- a/src/wrappers/srmd_ncnn_vulkan.py +++ b/src/wrappers/srmd_ncnn_vulkan.py @@ -66,6 +66,10 @@ class WrapperMain: ratio {int} -- output video ratio """ + # change the working directory to the binary's parent directory + # so the binary can find shared object files and other files + os.chdir(pathlib.Path(self.driver_settings['path']).parent) + # overwrite config file settings self.driver_settings['i'] = input_directory self.driver_settings['o'] = output_directory diff --git a/src/wrappers/waifu2x_caffe.py b/src/wrappers/waifu2x_caffe.py index 04adda7..b99fc80 100755 --- a/src/wrappers/waifu2x_caffe.py +++ b/src/wrappers/waifu2x_caffe.py @@ -73,6 +73,10 @@ class WrapperMain: """ start upscaling process """ + # change the working directory to the binary's parent directory + # so the binary can find shared object files and other files + os.chdir(pathlib.Path(self.driver_settings['path']).parent) + # overwrite config file settings self.driver_settings['input_path'] = input_directory self.driver_settings['output_path'] = output_directory diff --git a/src/wrappers/waifu2x_converter_cpp.py b/src/wrappers/waifu2x_converter_cpp.py index 14ca32e..ce05b47 100755 --- a/src/wrappers/waifu2x_converter_cpp.py +++ b/src/wrappers/waifu2x_converter_cpp.py @@ -82,8 +82,8 @@ class WrapperMain: threads {int} -- number of threads """ - # waifu2x-converter-cpp cannot fine libw2xc.so under Linux - # if the working directory is not waifu2x-converter-cpp's directory + # change the working directory to the binary's parent directory + # so the binary can find shared object files and other files os.chdir(pathlib.Path(self.driver_settings['path']).parent) # overwrite config file settings diff --git a/src/wrappers/waifu2x_ncnn_vulkan.py b/src/wrappers/waifu2x_ncnn_vulkan.py index ac32ab7..5ba4761 100755 --- a/src/wrappers/waifu2x_ncnn_vulkan.py +++ b/src/wrappers/waifu2x_ncnn_vulkan.py @@ -69,6 +69,10 @@ class WrapperMain: ratio {int} -- output video ratio """ + # change the working directory to the binary's parent directory + # so the binary can find shared object files and other files + os.chdir(pathlib.Path(self.driver_settings['path']).parent) + # overwrite config file settings self.driver_settings['i'] = input_directory self.driver_settings['o'] = output_directory