Jose's Read Only Forum 2023

IT-Consultant: Charles Pegge => OxygenBasic => Topic started by: Pierre Bellisle on October 02, 2022, 01:18:59 AM

Title: FileName
Post by: Pierre Bellisle on October 02, 2022, 01:18:59 AM
I got an error when I compile if the .o2bas filename include some space in it.
Either from Oxide or a batch file.
Adding double-quotes does'nt help...

Example: D:\Dev\Oxygen\o2w7\co2.exe -32 "D:\Dev\Oxygen\o2w7\~code\Caption Icon04.o2bas"

I got the error: ERROR: Include file not found d:\dev\oxygen\o2w7\~code\caption.inc
Title: Re: FileName
Post by: Pierre Bellisle on October 02, 2022, 01:37:28 AM
A legal filename can begin with, let's say "-A"
Like in D:\Dev\Oxygen\o2w7\co2.exe -32 -aCaption.o2bas
In that case the "-a" is misinterpreted as a compiler swicth.
Adding double-quotes resolve the situation.
Is there a place where I can find the exacts rules for feeding a command line to the compiler?

Added:
The co2.exe messagebox help  show the switches always before the <filename>
Aka: co2.exe -64 <filename> <optional filename>
Is there any problem putting thoses swicthes after filenames, [optional filename], [filename.res]
Seems OK to me...

Thank.

Title: Re: FileName
Post by: Charles Pegge on October 02, 2022, 08:55:03 AM
Hello Pierre,

I have altered co2, oxide and peroxide to support file pathnames containing spaces. When compiling with co2 in a dos console, you now need to enclose the spacey filenames with double-quotes.

Update P10
https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasic050P10.zip
Title: Re: FileName
Post by: Zlatko Vid on October 02, 2022, 02:08:09 PM
you always need to have filename with "" if you use spaces in names
simple:

chr(34) + file_name + chr(34)
Title: Re: FileName
Post by: Pierre Bellisle on October 02, 2022, 09:48:27 PM
Hi Charles,

Double-quotes for filenames with space is a good news.
I guess Microsoft sees it that way too.

Note that <co2.exe -32 -aCaption.o2bas> do not contain any space and will continue to be ambigious,
It might a rare case, still is <-a> a switch, or part of the filename?
I will always use double-quotes in my pre-compiler to avoid any misinterpretation.

By curiosity, I wanted to know if I can put the switches after filenames.
With no confirmation, I will play safe to avoid possible future problems.

Thank you very much Charles.
Title: Re: FileName
Post by: Charles Pegge on October 02, 2022, 10:52:24 PM
Yes, you will need to space the switches, and if a filename looks like a switch then put it between quotes. It is always safe to use quotes around filenames.

I think we need to keep the switches to the left of the filenames, but I will consider this issue.
Title: Re: FileName
Post by: Zlatko Vid on October 03, 2022, 07:59:49 AM
QuoteI think we need to keep the switches to the left of the filenames,

Of course that wee need to keep them from left

I really don't know any other compiler which use switch from right side or after filename.

Charles....
New request become really bizare
Title: Re: FileName
Post by: Charles Pegge on October 03, 2022, 09:20:54 AM
It is because there are optional filenames to the right: exe filenames and res filenames.
Title: Re: FileName
Post by: Zlatko Vid on October 03, 2022, 12:22:45 PM
QuoteIt is because there are optional filenames to the right: exe filenames and res filenames.

Yes ,,of course on right side are .ext -ensions