Files and their locations - their paths

aedwall

Active Member
Licensed User
Longtime User
My program has a file called seas_18.se1. I must set the path to this file in order to read from it. I have added this file to my list of files over on the far right panel. My program doesn't want to recognize this file or its path. It is physically located in the /PROJECT/Files folder. What am I missing? Another program I have has files in this location and I can read from them without doing anything special. What is the exact path to files put in this location? I thought it was File.DirAssets. Should I copy this file someplace else, then try and read it from the new folder? My problem is that I must set the path to this file and doing it with either File.DirAssets or File.DirInternal does not work - the seas_18.se1 is not being found. I am stuck trying to figure out a good path so my code can find this file. Thank you for any help you can provide.
 

aedwall

Active Member
Licensed User
Longtime User
Well, after spending hours on this issue, this is apparently what worked:

File.Copy(File.DirAssets, "seas_18.se1", File.DirInternal, "seas_18.se1")

then set the path to File.DirInternal.

I don't know why I needed to copy the file, then set the path to File.DirInternal. In my other application, I didn't have to copy the text files from File.DirAssets - I just read them from there and all was well. But I can't just read these - I must copy, then set the path to Dir.DirInternal.

I'm confused, still.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
File.DirAssets is read only. As stated above it is a place holder for the files you have added in the Files folder on the development machine. If you are just reading the file, you can read in some forms from the File.DirAssets. If you are writing to the file you will have to copy it to a location that it can be both read and written to. Think of the File.DirAssets as a CDrom you have written files to and closed the session. You can read it all you like but because you closed the session you can no longer write to it.
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
Thank you for this information. Apparently a text file is one of the kinds of files you can read from DirAssets without having to copy it somewhere else and read it from there. But a binary file like my xxx.se1 files DO need copying first, then reading from that new location. I do not write to any of these files. Now I have a situation where some of those .se1 files I copied work fine, but others don't work, with one even giving me a NullPointerException. Very weird. I know these files work on my desktop using regular VB, but 3 of them don't work at all in b4A. So 5 work, 3 return a 0 instead of a number from 0 to 360, and 1 bombs the program because of the NullPointerException. Very frustrating. Thanks for the info.
 
Upvote 0
Top