Open Malkverbena opened 1 month ago
The "create_debugger_header" function is receiving the first argument used after the scons command. This is generating errors. For example, if I use "-j8", the argument received by the function is "-j8". I believe the error is in SCsub, when the function is invoked.
What the function "create_debugger_header" supose to recive?
Line 8 will also cause issues on different platforms. The ideal would be to use: To ensure that your code works on Windows, Linux, and macOS, it is important to use directory separators that are compatible with all operating systems. In Python, the recommended way to build platform-independent file paths is by using os.path.join. Like this:
f = open(os.path.join(source_path, "core", "__generated__debugger_ui.h"), "w", encoding="utf-8")
I think the issue is caused by a recent change I needed to make in order to use the cpplize_debugger.py with CMake.
The change I did was adding these lines https://github.com/GameNetworking/NetworkSynchronizer/blob/main/debugger_ui/cpplize_debugger.py#L34-L40
With those lines, as soon as you execute that file the file is generated. The way I'm using it with CMake is this one: https://github.com/GameNetworking/NetworkSynchronizer/blob/main/cmake/CMakeLists.txt#L35-L39
The fix is to refactor the way the SCsub is implemented so that it "executes" the script instead of importing it and calling the function. If you have any other idea, I'm open to it.
What do you think about including a method to fix the value of the "source_path" variable?
Somethink like:
source_path = os.path.dirname(os.path.abspath(__file__))
On the SCsub? I think that make sense
Yes. but also can be done on cpplize_debugger.py. Depends what you have in mind. Simple adding the lines below to cpplize_debugger.py you can fix it. This makes the script determine the source_path insted to depend of poarameters coming from another scripts
source_path = os.path.dirname(os.path.abspath(__file__))
source_path = os.path.dirname(source_path)
What do you think about this solution?
def create_debugger_header(source_path):
if not os.path.exists(source_path):
source_path = os.path.dirname(os.path.abspath(__file__))
source_path = os.path.dirname(source_path)
I would prefer to have this logic inside the Scons config instead and prevent this section https://github.com/GameNetworking/NetworkSynchronizer/blob/main/debugger_ui/cpplize_debugger.py#L34-L40 from executing when the file is imported, somehow.
I dont undestood exacly when the funcion "create_debugger_header" is called. This function is being called on SCsub and on cpplize_debugger. In other words, it is being invoked twice. When this function is supposed to be called?
Should the "source_path" variable be passed in the function call or discovered automatically?
I prefer that we pass the path, because automatic discovering the directory is not going to work in all situations.
I just updated my fork and cant compile at all. After the #138 I got tons of errors. I
ll open a diferent issue foir that.