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

Importing text files from Windows #39

Open
philgoetz opened this issue Jan 23, 2020 · 3 comments
Open

Importing text files from Windows #39

philgoetz opened this issue Jan 23, 2020 · 3 comments

Comments

@philgoetz
Copy link

Great program! I had great difficulty using it to edit a text file just now.

  1. I opened a .DSK Apple 2 disk image (had to select "All files" instead of "disk images"; the .DSK type does not display with the "disk images" filter).
  2. I exported the T file I wanted to edit to my Windows filesystem.
  3. I edited that file with Vim and saved it.
  4. I imported the file from Windows back to my disk image.

The file import didn't work the first time, because if you try to import a file which already exists on the disk image, then instead of replacing it, Apple Commander adds another file of exactly the same name to the disk image.

The import did start to work when I first deleted the original file from the disk image.
However, the imported file had different line endings, and so wasn't readable from Applesoft.

The file export from the .DSK file created a file on my Windows system in which each line ended with hex 0D 0A.
Importing such a file back to the disk image using Apple Commander produces a file in which each line ends (according to Apple Commander's hex dump) with 8D 8A.
What we want is a file on the disk image where each line ends with 8D.
We can get this by giving Apple Commander a Windows file where each line ends with 0D instead of 0D 0A.
Neither dos2unix nor unix2dos will produce such a file, so I used the hex editor HxD to search-and-replace 0D 0A with 0D, saved that, then imported the resulting file using Apple Commander.
It worked!

@a2geek
Copy link
Contributor

a2geek commented Jan 24, 2020

Hey, thanks!

I'm uncertain if this helps, but the ac command-line app does have a -pt and -ptx option that should handle the line endings.

-pt      <imagename> <filename> put stdin in filename on image
         defaulting to TXT file type, setting high bit on and replacing
         newline characters with $8D.
-ptx     <imagename> <filename> put stdin in filename on image
         defaulting to TXT file type, clearing high bit and replacing
         newline characters with $0D.

Some samples are here: https://applecommander.github.io/ac/#put-standard-input-onto-disk-image-as-a-text-file

But, I expect duplicating that into a user interface ought to be done. Next round of updates. ;-)

@philgoetz
Copy link
Author

philgoetz commented Feb 5, 2020 via email

@a2geek
Copy link
Contributor

a2geek commented Feb 8, 2020

I wonder if this is useful? https://applecommander.github.io/install/#command-line

It references how to setup on the command-line and a sample bat file. (I actually can't find AppleCommander.bat in the sources, so I am guessing it's this batch file that is being referenced.)

@echo off
java -jar AppleCommander-1.4.0-ac.jar %*

It's been a while, but I think the %* passes in all parameters on the command-line.

As far as compiling, there is this: https://github.com/AppleCommander/AppleCommander/blob/master/DEVELOPER.md

Since AppleCommander uses Gradle, there is a provided link to Gradle for documentation on how to use that tooling. (It is an entire ecosystem to itself, and is a large topic.)

@a2geek a2geek added this to To Do in AppleCommander 1.7.0 Nov 17, 2020
@a2geek a2geek removed this from To Do in AppleCommander 1.7.0 Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants