Can't see/open file in same folder

Sorry for my absence the last few weeks; between a completely different project slamming into me right before the schools went on break (that experiment will be in a local school, not in space!), a firewall problem when trying to debug on the pc laptop (I see I mentioned that up above. right now it isn’t happening. No idea why…though I’ve also completely lost wireless connection – I’m typing from my mac right now; but Xojo at the moment will let me do things up to the point I can’t read the file), and the holidays and travel, I’m only just now returning to this problem.

Going back to things everyone has written…
(1) if I read the link "Debugging on Windows " posted by Brian Franco (the first response way back when) correctly, the file I’m trying to open and read from must be read-only (at least in the option that I understood…), and I need to be able to write this file at the end of the session. So unfortunately, I don’t think I can use that workaround (I didn’t really get the second option; I suppose I could try the first, though the file is already there, AFAIK, so I’m not sure what that would do)

(2) to Michel on Dec 20: Maybe it is finally time to get the license for the laptop so that I can build, but at the moment I’m just trying to simply debug. So, for the moment, I really need to solve the problem for debugging. (And I think I need to be able to debug in any case, so I really need to fix this.)

I’m going to print this out and try again to go over everyone’s suggestions very carefully, but I think I’ve already tried all the things that I understand (that aren’t to do with building instead of debugging), and I am still not able to read that file.

To recap, I have a text file, call it jak_session.txt, which I need to open and read from at the beginning of the program run, and then update the value and write that to the file at the end of the program run. Right now I am just debugging on the PC, not yet building and running the .exe. The .txt file resides in the same folder as the source code. It also resides in a folder that I have hard-coded. Whether I try to just open the file with no path, or with the hard-coded path, I get an error that it cannot open the file.

The current line for opening the file is
Num = GetFolderItem("").Parent.Child(SubjectSessionNumberFileName)
where SubjectSessionNumberFileName is the full path name of the file.

Meanwhile I’m trying to build a very simple program to open files and read them, to try to better understand this whole path thing. (I don’t know why this is such a problem for me; I’m a good programmer for a lot of things; but dealing with file reading on a system different from what I know is proving to be a hurdle.

Thanks again for all your help.
Carolyn B-G

Carolyn, the method I gave you works fine with debug. I verified it :slight_smile:

Ah…all that build and build wheel and so forth made me think it was only for building. Sorry and thanks for the clarification!
[…][quote]
add a copyfile build step and copy jak.txt into the App Parent Folder,[/quote]
This now makes sense to me. Done.

[quote]
then make sure to drag the copyfile down in Windows build,[/quote]
I think I know what you mean, so I grabbed the newly created CopyFile1 (which contains the jak file as well as a cjbg file, because I’m actually testing with multiple files) on the left panel down the panel to Build settings and put it in the Windows bit. Right so far? I tried it with the CopyFiles above “build” and got an error. I placed it below “Build” (I guess that’s what you mean by "under the build wheel) and did not get that error (progress), however, when it gets to the point of opening the file, I am still getting the “exception of NilObjectException was not handled.” :frowning:

I must still be missing something somewhere.

I was able to get the file to open, and read from it, in my little dummy program just now. I’m going to compare the code and see what I’m doing differently…

Thanks, and I do appreciate your time in helping this windows neophyte…
Carolyn

Great. The nice thing is that it will enable you to use the file with the debug version, although the debug folder gets erased after you quit the debug program. And you do not need a different path for debug and build.

Glad to be of help. Good luck :slight_smile:

Well, I don’t know why exactly what works is working, nor why my first attempt at replicating what was in the dummy program didn’t work, but I actually have a working kludge at the moment that opens that file and gets me past that bottleneck, so I can go on and debug the rest. I don’t know if this will stick for when we actually have to build, but for now I can go on.

THANK YOU ALL SO MUCH. (Just having so many people taking time to think about my program was a huge help in and of itself, because besides you all, I am completely on my own for this.)

I’m sure I’ll be back asking more questions :-/
cjbg

The method I gave you works fine for debugging and will copy the files to the build folder when the time comes. However, you will still need to have the files copied to the program folder upon install. Most installers do that easily. For now, enjoy your debugging :slight_smile:

PS : Never hesitate to ask :wink: