Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mega65_ftp issues with long filenames #164

Open
Taygair opened this issue Apr 23, 2023 · 2 comments
Open

mega65_ftp issues with long filenames #164

Taygair opened this issue Apr 23, 2023 · 2 comments
Labels
new New report, not classified yet

Comments

@Taygair
Copy link

Taygair commented Apr 23, 2023

With the new version of M65Connect I want to support long filenames. I've experienced issues with some commands:

MOUNT a D81 image with a space in filename or bigger than 8 chars: Will be processed with no error message but image will not be mounted
Example: mega65_ftp.osx -l /dev/cu.usbserial-25163305977F1 -s 2000000 -c "mount "MY REAL ORDER.D81""

RENAME doesn't seem to consider case sensitivity:
mega65_ftp.osx" -l /dev/cu.usbserial-25163305977F1 -s 2000000 -c "rename "My File.D81" "My FILE.D81""

Output: ERROR: Cannot rename to "My FILE.D81", as this file already exists.

@Taygair Taygair added the new New report, not classified yet label Apr 23, 2023
@Taygair Taygair changed the title mega65_ftp mega65_ftp issues with long filenames Apr 23, 2023
@gurcei
Copy link
Collaborator

gurcei commented Apr 25, 2023

Will just share some thoughts on how double-quotes within double-quotes, tends to be tricky (and probably isn't related to all the matters you mentioned, but maybe some).

The way it can be handled can vary depending on whether you're trying to get it to work:

  • from the console (which also varies depending on OS)
  • from within your code (which could vary depending on language choice: c/xojo/etc)

Getting double-quotes-within-double-quotes to work in the console

Linux/Mac osx

method 1: escaping internal double-quotes

With this technique, you could just escape the internal double-quotes with the backslash character.

mega65_ftp.odx -l /dev/cu... -s 2000000 -c "rename \"My File.D81\" \"MY FILE.D81\" "

  • Note all internal double-quotes now have backslashes
    • `"My File.D81"
    • \"MY FILES.D81\"
  • Note that the external double-quotes don't need the backslashes
    • -c "rename...
    • ...D81\" "

method 2: avoidance: use single-quote and double-quote

Another technique is to avoid the situation by using single-quotes externally, but double-quotes internally. E.g.:

mega65_ftp.odx -l /dev/cu... -s 2000000 -c 'rename "My File.D81" "MY FILE.D81" '

  • note the single-quote used for the 'rename (instead of double-quote)
  • note the single-quote used for the end .D81" ' (instead of double-quote)

(I added a space between the last double-quote and last single-quote just for clarity, the extra space isn't really needed)

@Taygair
Copy link
Author

Taygair commented Apr 25, 2023

Thanks for the explanation! I'm aware of it and remembered the discussion about it we had in in the past. In between the mega65_ftp was enhanced, partly restructured/refactored so I gave it another try to support longer filenames with spaces and upper/lowercases. That all works fine on rename (well there is sometimes a weird behavior that I can't reproduce), delete and also copy.
For removing visual complexity I wanted to show some simple examples and removed what I REALLY send, what made you thinking I'm not escaping double quotes So in truth I'm working with " on mount, rename, copy and delete.

Concrete example of what I'm sending for a mount command:
mega65_ftp.osx -l /dev/cu.usbserial-25163305977F1 -s 2000000 -c "mount \"My File.D81\""
That should cover your concerns. Maybe that problem only exists in the OSX versions. Does it work that way on Linux, image got truly mounted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New report, not classified yet
Projects
None yet
Development

No branches or pull requests

2 participants