Jump to content

[4.6 + Linux] Agument Flag Fragmentation.


Recommended Posts

I've noticed that when using the shell scripts, the argument list doesn't work correctly. The last flag set (ex: -smallwindow) doesn't save correctly.

My test snip:

	//Load command-line parameters
	System::ParseCommandLine(argc, argv);
	
	for (auto& p : System::Arguments)
	{
		System::Print("Key: " + p.first + " = " + p.second);
	}

Results:

steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest.sh -devmode
 = 1 devmode
steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest.sh +devmode 1
Key: devmode = 1
steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest.sh -devmode +sw 1800
Key: devmode = 1
Key: sw = 1800
steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest.sh -devmode -smallwindow
Key: devmode = 1
 = 1 smallwindow

 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

I just tested by setting the command line arguments in Visual Studio to "-devmode -smallscreen" and it worked exactly as expected, with the values "devmode" and "smallscreen" both being set to "1".

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'm pretty sure with Windows this works fine, it's with Linux I've found the issue. Not sure what's going on here, might be the use of the shell script.

What's also weird is that with my example, "Key" vanishes, so not exactly sure what's going on here.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

I can't remember how to show the debugger in Code::Blocks and it doesn't let you view printed output, so I have no way to view what the parsing results are right now.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Okay, I found it. You need the "call stack" and "watches" windows open.

I tried testing with the command line "-devmode -smallscreen" and it worked perfectly. Now I am testing your print code...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

    std::string cl;

    for (auto& p : System::Arguments)
    {
	    cl += std::string("Key: " + p.first + " = " + p.second + "\n");
    }

Seems to work fine.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Tried this, still the same results. The application still launches in fullscreen unless a bogus flag is added at the end
 before "-devmode" so that's evidence that the flag is not registering correctly.

Quote

steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest.sh -devmode
 = 1 devmode

 

Next time you're compiling on Linux, please take a look if you're not doing so already. I don't have this issue on Windows ether.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

I think the problem lies in the SH file. Have you tried running the executable directly?

./CodeLiteTest -devmode

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'm unable to as the application refuses to launch without that Library path bit.

Quote

steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest -devmode
./CodeLiteTest: error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory

Tried hard setting flags within the script.

export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
./CodeLiteTest -devmode -flag -flag2

Same results:

steven@blackbox:~/Documents/Leadwerks/Projects/CodeLiteTest$ ./CodeLiteTest.sh
Key: devmode = 1
Key: flag = 1
 = 1 flag2

 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Used the code above:

With the dummy flag

steven@blackbox:~/Documents/Leadwerks/Projects/ActorTest$ ./ActorTest.sh -devmode -l
Reep Softworks - (ActorTest)
Initializing Lua...
Warning: Lua sandboxing disabled.
Executing file "/home/steven/Documents/Leadwerks/Projects/ActorTest/Scripts/Error.lua"
./ActorTest
-devmode
-l
Installing Game: SDK
Initializing OpenGL graphics driver...

Without:

steven@blackbox:~/Documents/Leadwerks/Projects/ActorTest$ ./ActorTest.sh -devmode
Reep Softworks - (ActorTest)
Initializing Lua...
Warning: Lua sandboxing disabled.
Executing file "/home/steven/Documents/Leadwerks/Projects/ActorTest/Scripts/Error.lua"
Installing Game: SDK
Initializing OpenGL graphics driver...

 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

I thought we determined the launch script was where the error was? The argc, argv values are C++ stuff, and they were missing parameters.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...