Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

Replace the full path to 'Jou'? #506

Closed littlewhitecloud closed 2 months ago

littlewhitecloud commented 2 months ago

Before:

D:\jou-main\jou-main\jou.exe: missing Jou file name (try "D:\jou-main\jou-main\jou.exe --help")

After:

Jou: missing Jou file name (try "D:\jou-main\jou-main\jou.exe --help")
Akuli commented 2 months ago

This could be confusing if someone has two installations of jou, and the executables are named e.g. jou.exe and jou2.exe. Unlikely but technically possible.

How are you running jou? Jou uses argv[0] for these messages, and usually argv[0] is set to a shorter string, something like "jou.exe" (Windows) or "./jou" (MacOS and Linux).

littlewhitecloud commented 2 months ago

image It seems that the argv[0] didn't set to ".\jou".

Akuli commented 2 months ago

Here's what it's supposed to look like:

screenshot-1713091673

Apparently this is a windows thing: https://stackoverflow.com/questions/7941536/windows-vs-linux-gcc-argv0-value

Using argv[0] to refer to "this program" is a standard thing to do in C, and almost all other programs do it, so changing it could be a bad idea. That said, I can't think of anything that would go wrong practically if we just use "jou" instead of argv[0]. Even if someone has two jous installed, there are other ways to check which jou is being used.

littlewhitecloud commented 2 months ago

Ok. Sorry to interrupt.

Akuli commented 2 months ago

No problem, it was a good question and I didn't know argv[0] is the full path on Windows :)