diff --git a/dummyfilescreator.py b/dummyfilescreator.py index 71faa00..6a3305b 100755 --- a/dummyfilescreator.py +++ b/dummyfilescreator.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 from dummyfilescreator.__main__ import main if __name__ == "__main__": diff --git a/dummyfilescreator/__main__.py b/dummyfilescreator/__main__.py index 6fe8b91..4dacd68 100755 --- a/dummyfilescreator/__main__.py +++ b/dummyfilescreator/__main__.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 """Author: Matuzalem (Mat) Muller. License: GPLv3 diff --git a/dummyfilescreator/dfc_cli.py b/dummyfilescreator/dfc_cli.py index 7427ff9..61ca273 100644 --- a/dummyfilescreator/dfc_cli.py +++ b/dummyfilescreator/dfc_cli.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """Author: Matuzalem (Mat) Muller. License: GPLv3 @@ -84,7 +85,13 @@ def __init__(self): # pylint: disable=too-many-branches ) args = vars(parser.parse_args()) - self.__folder_path = f"{args['output']}" + output = f"{args['output']}" + if output[-1] == "/": + output = output[:-1] + elif output[-1] == "\\": + output = output[:-1] + self.__folder_path = output + self.__number_files = int(args["n_files"]) self.__size_file = int(args["size"]) @@ -124,7 +131,12 @@ def __init__(self): # pylint: disable=too-many-branches self.__progressbar = None if args["log"] is not None: - self.__log_path = f"{args['log']}" + log = f"{args['log']}" + if log[-1] == "/": + log = log[:-1] + elif log[-1] == "\\": + log = log[:-1] + self.__log_path = log else: self.__log_path = None @@ -210,3 +222,11 @@ def run(self): except IOError as error: print(f"CLI: Error starting FilesCreator thread: {error}") sys.exit(1) + +def main(): + """Entrypoint in case this file is executed directly.""" + app = DFCCli() + app.run() + +if __name__ == "__main__": + main() diff --git a/dummyfilescreator/dfc_ui.py b/dummyfilescreator/dfc_ui.py index dc97746..f9f6711 100644 --- a/dummyfilescreator/dfc_ui.py +++ b/dummyfilescreator/dfc_ui.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 """Author: Matuzalem (Mat) Muller. License: GPLv3 @@ -250,13 +250,25 @@ def __click_button_create_stop(self): # pylint: disable=too-many-branches if self.__main_window.button_create_stop.text() == "Create": size_file = int(self.__main_window.text_size_files.text()) chunk_size = int(self.__main_window.text_chunk_size.text()) + if self.__main_window.text_path.text()[-1] == "/": + path = self.__main_window.text_path.text()[:-1] + elif self.__main_window.text_path.text()[-1] == "\\": + path = self.__main_window.text_path.text()[:-1] + else: + path = self.__main_window.text_path.text() if self.__main_window.checkbox_savelog.isChecked(): - log_path = self.__main_window.text_logfilepath.text() + if self.__main_window.text_logfilepath.text()[-1] == "/": + log_path = self.__main_window.text_logfilepath.text()[:-1] + elif self.__main_window.text_logfilepath.text()[-1] == "\\": + log_path = self.__main_window.text_logfilepath.text()[:-1] + else: + log_path = self.__main_window.text_logfilepath.text() else: log_path = None try: + print(log_path) self.__creator_thread = FilesCreator( - folder_path=self.__main_window.text_path.text(), + folder_path=path, number_files=int(self.__main_window.text_n_files.text()), size_file=size_file, size_unit=self.__main_window.combo_file_unit.currentText(), diff --git a/pkg/linux/build_package.py b/pkg/linux/build_package.py index cb699ad..003c879 100755 --- a/pkg/linux/build_package.py +++ b/pkg/linux/build_package.py @@ -60,7 +60,7 @@ def is_program_installed(program_name: str): if shutil.which(program_name): print(f"{program_name} is installed") return True - print(f"{program_name} not installed") + print(f"{program_name} not installed (or not added to $PATH)") return False