Skip to content

Commit

Permalink
COE-807: Fix path definition issue between Linux and Window environme…
Browse files Browse the repository at this point in the history
…nt (#53)

* COE-807: change backslash to forward slash when creating filepath

* COE-807: use a global variable to define name of data files folder

Co-authored-by: Nam Nhat Pham <[email protected]>
  • Loading branch information
namnhatpham and Nam Nhat Pham authored Jan 6, 2023
1 parent ad05f4d commit aaa922e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions simulators/extras/ImportData.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from datetime import datetime

# Data File Folder
EXPORT_DATA_FOLDER = 'export_data'
# Global variables and constants
timeFormat = "%Y-%m-%dT%H:%M:%S.%fZ"
logTimeFormat = "%Y%m%d%H%M%S_%f"
Expand Down Expand Up @@ -152,7 +154,7 @@ def CheckFileList(filepath):
def ReplaceFileNameWithFilePathInList(list_of_files):
list_of_file_paths = []
for data_file_name in list_of_files:
data_file_path = 'export_data' + "\ ".strip() + data_file_name
data_file_path = EXPORT_DATA_FOLDER + "/" + data_file_name
list_of_file_paths.append(data_file_path)
return list_of_file_paths

Expand All @@ -170,7 +172,7 @@ def AddJsonExtensionToFileNameList(list_of_filenames):
listOfFileNamesWithExtension = AddJsonExtensionToFileNameList(list_of_filenames=json_filename_list_to_import)
listOfFilePaths = ReplaceFileNameWithFilePathInList(list_of_files=listOfFileNamesWithExtension)
else:
listOfFiles = CheckFileList(filepath='export_data')
listOfFiles = CheckFileList(filepath=EXPORT_DATA_FOLDER)
listOfFilePaths = ReplaceFileNameWithFilePathInList(list_of_files=listOfFiles)

for filePath in listOfFilePaths:
Expand Down

0 comments on commit aaa922e

Please sign in to comment.