Author Topic: FileName  (Read 541 times)

0 Members and 1 Guest are viewing this topic.

Offline Pierre Bellisle

  • JK-Mitglieder
  • Full Member
  • *
  • Posts: 157
  • User-Rate: +12/-7
FileName
« 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
« Last Edit: October 02, 2022, 01:38:38 AM by Pierre Bellisle »

Offline Pierre Bellisle

  • JK-Mitglieder
  • Full Member
  • *
  • Posts: 157
  • User-Rate: +12/-7
Re: FileName
« Reply #1 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.

« Last Edit: October 02, 2022, 07:00:05 AM by Pierre Bellisle »

Online Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 895
  • User-Rate: +33/-1
    • Charles Pegge
Re: FileName
« Reply #2 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

Offline Zlatko Vid

  • Full Member
  • ***
  • Posts: 236
  • User-Rate: +2/-2
Re: FileName
« Reply #3 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)

Offline Pierre Bellisle

  • JK-Mitglieder
  • Full Member
  • *
  • Posts: 157
  • User-Rate: +12/-7
Re: FileName
« Reply #4 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.

Online Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 895
  • User-Rate: +33/-1
    • Charles Pegge
Re: FileName
« Reply #5 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.

Offline Zlatko Vid

  • Full Member
  • ***
  • Posts: 236
  • User-Rate: +2/-2
Re: FileName
« Reply #6 on: October 03, 2022, 07:59:49 AM »
Quote
I 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

Online Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 895
  • User-Rate: +33/-1
    • Charles Pegge
Re: FileName
« Reply #7 on: October 03, 2022, 09:20:54 AM »
It is because there are optional filenames to the right: exe filenames and res filenames.

Offline Zlatko Vid

  • Full Member
  • ***
  • Posts: 236
  • User-Rate: +2/-2
Re: FileName
« Reply #8 on: October 03, 2022, 12:22:45 PM »
Quote
It is because there are optional filenames to the right: exe filenames and res filenames.

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