Section 9 - For Mac Users

1A.9.1 Eclipse Users

The documentation in the iTunes (or EBookEntry or StarNearEarth) folders explains how to copy the .txt file into your project directory under Eclipse's workspace. You will still need to open that file in Eclipse and use the File→Convert Line Delimiters To: Unix option.

shot

1A.9.2 Xcode Users

Setting the Working Directory

If we don't set the working directory on Xcode, our run will not find the file itunes_file.txt:

shot

This is easy to fix. Use Product→Scheme→Edit Scheme:

shot

Check the box Working Directory→Use custom... :

shot

Navigate to your project folder, but not to the source inside the project (which may have the same name):

shot

Fixing the Newline Characters

Xcode users have to do the same thing that Eclipse user's did in section 9.1, above, but Xcode does not have this one-click fix.

If you happen to have Eclipse installed on your computer, you can open it just for the purpose of changing the newline characters as shown above. If not, you'll have to use the AppleScript editor to do the job for you. We'll go through that, now.

Notice that if you run the program without fixing the newline characters, you'll get the wrong output:

shot

We open itunes_file.txt using the AppleScript Editor:

shot

You will get some error messages which you should ignore by clicking OK and being happy:

shot

... another one:

shot

Now we Save As ...

shot

Use the default file name, but select the option Text:

shot

Another ignorable error (click OK):

shot

You can quit the AppleScript Editor:

shot

In the finder, we can see the new file we created (without a .txt extension).

shot

We have to change the names.

  1. First, rename the original to something else (maybe append _ORIG to the name) so we have it as a back-up, then
  2. rename itunes_file by adding a .txt extension. You will have to click "Use .txt" in the warning alert.

Both steps are shown in this one screen shot:

shot

We see the result of our hard work in the finder:

shot

Finally, when we run the program, we get the desired output.

shot