From 9a2f725aa2f45ad3d0b1b344d8e79355d9965bf9 Mon Sep 17 00:00:00 2001 From: sowens99 Date: Mon, 25 Sep 2023 14:34:01 -0400 Subject: [PATCH] Use utils.get_script_dir() instead of os.get_cwd() --- scripts/Modules/TTK_Lib.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Modules/TTK_Lib.py b/scripts/Modules/TTK_Lib.py index aa756bc..65aa8b5 100644 --- a/scripts/Modules/TTK_Lib.py +++ b/scripts/Modules/TTK_Lib.py @@ -260,7 +260,7 @@ def writeToCSV(inputs: FrameSequence, playerType: PlayerType) -> None: # Get csv file path playerStr = "Player" if playerType == PlayerType.PLAYER else "Ghost" relativePath = config.textFilePath(playerStr) - absolutePath = os.path.join(os.getcwd(), "User/Load/Scripts/", relativePath) + absolutePath = os.path.join(utils.get_script_dir(), relativePath) # Write to csv, error if cannot write if inputs.writeToFile(absolutePath): @@ -273,7 +273,7 @@ def writeToCSV(inputs: FrameSequence, playerType: PlayerType) -> None: def writeToBackupCSV(inputs: FrameSequence, backupNumber: int) -> None: relativePath = config.textFilePath("Backup") relativePath = relativePath.replace("##", "{:02d}".format(backupNumber)) - inputs.writeToFile(os.path.join(os.getcwd(), "User/Load/Scripts/", relativePath)) + inputs.writeToFile(os.path.join(utils.get_script_dir(), relativePath)) def getMetadataAndWriteToRKG(inputs: FrameSequence, playerType: PlayerType) -> None: # Get metadata @@ -295,7 +295,7 @@ def writeToRKG(fileBytes: bytearray, playerType: PlayerType) -> None: # Get csv file path playerStr = "Player" if playerType == PlayerType.PLAYER else "Ghost" relativePath = config.rkgFilePath[playerStr] - absolutePath = os.path.join(os.getcwd(), "User/Load/Scripts/", relativePath) + absolutePath = os.path.join(utils.get_script_dir(), relativePath) try: with open(absolutePath, "wb") as f: @@ -310,7 +310,7 @@ def getInputSequenceFromCSV(playerType: PlayerType) -> FrameSequence: # Get csv file path playerStr = "Player" if playerType == PlayerType.PLAYER else "Ghost" relativePath = config.textFilePath(playerStr) - absolutePath = os.path.join(os.getcwd(), "User/Load/Scripts/", relativePath) + absolutePath = os.path.join(utils.get_script_dir(), relativePath) # Get the frame sequence return FrameSequence(absolutePath)