Amazon.com Widgets Where are the files located?
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2013, 11:31:14 PM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Programming in Objective-C, 4th edition
| |-+  Chapter 19
| | |-+  Where are the files located?
Pages: [1]   Go Down
Print
Author Topic: Where are the files located?  (Read 1370 times)
seerex
Full Member
***
Posts: 177


Email




« on: March 23, 2012, 08:43:20 AM »

Hello all!

I've recently started cracking the last few chapters that i didn't finish yet. I'm having a little trouble understanding the whole file-management thing.

For instance, when using methods to write to file, like the book uses [glossary writeToFile:automatically:] and the archiver [NSKeyedArchiver archiveRootObject:toFile:], where exactly are these files located? i can read the files back in again like the book shows, but at one point the books states "If you examine the contents of the file", which means i actually have to locate the file, which i can't do.

I've tried looking and even searching for it, with no luck Sad

Thanks on advance
Logged

Best Regards -
J.B.J
If you think i helped you could return the favor Wink

Subscribe to my channel on youtube: http://www.youtube.com/user/JBJProgramming

My apps:
- iTap Fruits (all countries)
- Toilet-Quiz (Denmark only)
- Zoo Kids (Denmark only)
- Diablo Item Database (All countries)
skochan
Administrator
Hero Member
*****
Posts: 3104







« Reply #1 on: March 23, 2012, 11:15:14 AM »

Search the forum for this.  I've answered it a couple of times already (look for questions in Chapter 16).

Cheers,

Steve
Logged
seerex
Full Member
***
Posts: 177


Email




« Reply #2 on: March 24, 2012, 04:55:55 AM »

Sorry to be a moron Steve, but i can't seem to find it. I've looked at the chapter 16 for the third edition, and i myself have asked there as well with no luck in an answer. I tried going back to the second edition, but people mostly just had problems getting the right path in the program to get it to run, and understanding absolute and relative path names. Haven't been able to see anyone in regards of where the files actually are, so that you can go in and click on them etc.

I'm sure it's there somewhere, so if you could maybe just give me a link or someone else could i'd be thrilled (and embarrassed for not being able to find it myself).

Thanks on advance. Looking forward to finishing the rest of the text Smiley
Logged

Best Regards -
J.B.J
If you think i helped you could return the favor Wink

Subscribe to my channel on youtube: http://www.youtube.com/user/JBJProgramming

My apps:
- iTap Fruits (all countries)
- Toilet-Quiz (Denmark only)
- Zoo Kids (Denmark only)
- Diablo Item Database (All countries)
skochan
Administrator
Hero Member
*****
Posts: 3104







« Reply #3 on: March 25, 2012, 01:30:27 PM »

I see from your question in Chapter 16 that you figured this out.  Is that not correct?

Here's the note from Chapter 16:

Quote
Note

You can create testfile with Xcode by selecting File, New, New File.... In the left pane that appears, highlight Other, and then select Empty in the right pane. Enter testfile as the name of the file and be sure to create it in the same directory as your executable file. If you have trouble locating the directory, use the currentDirectoryPath: method as described later in this section. Or, you can use a full pathname to the file, as in /Users/steve/testfile (here you would substitute your username for “steve”).

In any case, if you're confused at all, just use full path names for the files.

Cheers,

Steve
Logged
seerex
Full Member
***
Posts: 177


Email




« Reply #4 on: March 26, 2012, 01:25:38 AM »

Hi Steve,

thanks for helping me once again, without your book and dedication to reply on this forum, i would still be learning about loops ^^

Well i partially got this, but what i don't understand is where new files created programmatically are stored? Or maybe you can't even do this? I just assumed that if you wrote things to a file that didn't exist, the program created the file itself, yes?

What stumbles me, is that i for instance have a project that has a plist. I can read and write data from it without too much trouble, but if i enter the plist in the Xcode project, it's still blank, but if i run the program it reads the correct data? Does the program have it's own copy of the file?

On a side note - i just finished the chapter, and i was hoping it went through the ability to read objects in from a file. Like when you talk about archiving / unarchiving, you can unarchive objects you archived. But i was wondering if there is a way so only need to unarchive, and you can write all the data into a file (for instance stored on the internet), so it creates object from that file, without you needing to programmatically create all objects?

Hope it made sense, and once again, thank you Master Steven Smiley
Logged

Best Regards -
J.B.J
If you think i helped you could return the favor Wink

Subscribe to my channel on youtube: http://www.youtube.com/user/JBJProgramming

My apps:
- iTap Fruits (all countries)
- Toilet-Quiz (Denmark only)
- Zoo Kids (Denmark only)
- Diablo Item Database (All countries)
jirvin
Newbie
*
Posts: 1






« Reply #5 on: June 11, 2012, 12:12:19 AM »

The file will be created in the same directory as the executable, unless you use an absolute pathname.  So the real question is, where does Xcode put your executable?  The answer is, it changed in Xcode 4 - earlier versions of Xcode used to put it in a more intuitive location, a build directory inside your project folder; e.g. if your project was named Chapter_19_prog_1, it put it here:

   Chapter_19_prog_1/build/debug

Now it puts it under the User Library folder, like so:

   ~/Library/Developer/Xcode/DerivedData/Chapter_19_prog_1/Build/Products/Debug

That is where you will also find the file "glossary" that your program creates.

Another way to find your executable, say if you forget, is via Xcode's Project Navigator.  Just select the Products folder, open its disclosure triangle, select your executable, right-click on it, and choose Show in Finder.

You can change where Xcode stores things, via the Preferences/Locations/Derived Data, but, you may want to leave that alone - it is easy enough to find stuff once you know where to look :-)

- jarrell
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.