Skip to content

Commit bb1b2aa

Browse files
authored
Merge pull request #3 from rafbiels/fix-inputgen-path
Fix InputFileGenerator relative paths
2 parents 56fdcfd + fcd5c49 commit bb1b2aa

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ endif()
3232

3333
find_package(Python QUIET)
3434
if(Python_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/scripts/InputFileGenerator.py")
35-
execute_process(COMMAND ${Python_EXECUTABLE} ../scripts/InputFileGenerator.py)
35+
execute_process(COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/InputFileGenerator.py)
3636
else()
3737
message(WARNING "Unable to generate input configuration files")
3838
endif()

scripts/InputFileGenerator.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import json
4141
import random
4242
import sys
43+
import os
4344
from threading import Thread
4445
import time
4546

@@ -711,9 +712,11 @@ def main(argv):
711712

712713
# Write configurations to JSON files
713714
for config in toGenerate:
714-
with open("../input/" + config[0] + ".json", "w") as out:
715+
outputDir = os.path.dirname(os.path.realpath(__file__)) + '/../input/'
716+
outputFileName = outputDir + config[0] + ".json"
717+
with open(outputFileName, "w") as out:
715718
json.dump(config[1], out, ensure_ascii=False, indent=4)
716-
print("Finished Generating ../input/" + config[0] + ".json")
719+
print("Finished Generating " + outputFileName)
717720

718721

719722
if __name__ == "__main__":

0 commit comments

Comments
 (0)