Files not loading when path changed

E

elShazo

Question: Program was originally developed in directory "/home/dude/
desktop/program" with subdirectores. I want the program and the files
it needs to run (images, settings files, etc.) from a new source. I
have changed the code to refer to just the subdirectories (i.e. /
images/terrain) instead of the fully qualified path (/home/dude/
desktop/program/images/terrain). Some of the images load and some do
not. The code appears to be correct, I just changed all fully
qualified paths to the /subdir. I also tried changing to a different
fully qualified path and had the same results (after copying the
needed files to the correct new location).

Program is being developed in Fedora Core 6, using C++ and Qt3.

Any ideas?
 
I

Ian Collins

Question: Program was originally developed in directory "/home/dude/
desktop/program" with subdirectores. I want the program and the files
it needs to run (images, settings files, etc.) from a new source. I
have changed the code to refer to just the subdirectories (i.e. /
images/terrain) instead of the fully qualified path (/home/dude/
desktop/program/images/terrain). Some of the images load and some do
not. The code appears to be correct, I just changed all fully
qualified paths to the /subdir. I also tried changing to a different
fully qualified path and had the same results (after copying the
needed files to the correct new location).

Program is being developed in Fedora Core 6, using C++ and Qt3.

Any ideas?
Again, you don't post enough information to get a meaningful answer.
 
E

elShazo

Again, you don't post enough information to get a meaningful answer.


Well, I was hoping for a general "here's where to start looking" kind
of answer. Such as, can you use a non-fully qualified file name like
this "mySettingsIFile.open ("/gameSettings/gameSettings.txt");" or
would you have to use a fully qualified name such as this
"mySettingsIFile.open ("/usr/games/TrafficKing/gameSettings/
gameSettings.txt");"?
 
I

Ian Collins

*Please* don't quote signatures.
Well, I was hoping for a general "here's where to start looking" kind
of answer. Such as, can you use a non-fully qualified file name like
this "mySettingsIFile.open ("/gameSettings/gameSettings.txt");" or
would you have to use a fully qualified name such as this
"mySettingsIFile.open ("/usr/games/TrafficKing/gameSettings/
gameSettings.txt");"?
<OT>Any pathname starting with a '/' is a full pathname.</OT>
 
G

Gianni Mariani

Well, I was hoping for a general "here's where to start looking" kind
of answer. Such as, can you use a non-fully qualified file name like
this "mySettingsIFile.open ("/gameSettings/gameSettings.txt");" or
would you have to use a fully qualified name such as this
"mySettingsIFile.open ("/usr/games/TrafficKing/gameSettings/
gameSettings.txt");"?

If you're running on Linux then do an strace of the program and see what
it's doing, when you figure out what you really want it to do then
program that. Under windows there is a similar utility for logging file
accesses.


Nothing here is specific to C++ tho...
 
P

Philo

*Please* don't quote signatures.




<OT>Any pathname starting with a '/' is a full pathname.</OT>

Any pathname starting with a '/' is a full pathname?
Are you sure of that?
 
I

Ian Collins

*Please* trim signatures and that google quoted test crap.
Any pathname starting with a '/' is a full pathname?
Are you sure of that?
On a UNIX like file system, yes.
 
J

Jim Langston

Ian Collins said:
*Please* trim signatures and that google quoted test crap.

On a UNIX like file system, yes.

On a DOS/Windows like file system too.

If you want a path off of the current path, you leave off the first /.
"somedir/someotherdir/someotherotherdir/somefile"
 
P

Philo

On a DOS/Windows like file system too.

If you want a path off of the current path, you leave off the first /.
"somedir/someotherdir/someotherotherdir/somefile"

lan\Jim,
Thanks!
 
J

James Kanze

Any pathname starting with a '/' is a full pathname?
Are you sure of that?

Well, it depends on the system. (That's why he put the <OT>
around it, I'm sure.) Under Unix, any pathname starting with
'/' (and no other pathnames) is an absolute pathname; i.e. a
pathname taken from the system root, and not from the current
directory. The rules for Windows are considerably more
complicated, but any pathname starting with '/' or '\\' is
interpreted as an absolute pathname on the currently selected
drive, taken from the root of the currently selected drive;
there are also other formats which are considered absolute. I
match the regular expression:
absolute( "[[:alpha:]]:"
"|[/\\\\][/\\\\][^<>:\"/\\\\\\|]+[/\\\\][^<>:\"/\\\\\\|]
+" ) ;
in my own code. (Note that both the compiler and the regular
expression parser interpret backslashes, so that it takes four
backslashes in a row to literally match a single backslash, and
two for the regular expressions parser to see it. So that
something like "\\\\\\|" means a literal backslash, followed by
a literal | character.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,298
Messages
2,571,542
Members
48,284
Latest member
RedaBruno6

Latest Threads

Top