View unanswered posts | View active topics It is currently Thu Aug 22, 2019 10:34 pm



Reply to topic  [ 22 posts ] 
Relative Paths 
Author Message
New Member

Joined: Fri Apr 13, 2007 3:06 am
Posts: 4
Reply with quote
Post Relative Paths
Suggestion: An example of how to use relative paths to put save files and such into a local saves directory.
e.g. .\saves

Maybe I just missed something obvious, but I was having trouble making ZSNES put my save files into a directory other than where my roms are stores. I got a mysterious could not save error if I had \saves\ or saves\ as my path.

In docs right now are relative (..\..\saves) or absolute (c:\zsnes\saves)

It took me a while digging through the forums to find a link to wikipedia to remedy my problem. A single period. Gah. An extra line or two to make things clearer might be nice.


Fri Apr 13, 2007 3:35 am
Profile
Veteran
User avatar

Joined: Thu Feb 03, 2005 8:18 pm
Posts: 768
Reply with quote
Post 
Nach and/or anyone who knows, do relative paths work as expected with ZSNES these days? I thing I remember a while ago they didn't work in all conditions.

And someone remind me, what does one dot do? Two dots are up one folder, right?

_________________
Official ZSNES Docs | NSRT Guide | Using a Wiimote w/ emulators


Fri Apr 13, 2007 5:21 am
Profile WWW
ZSNES Developer
ZSNES Developer

Joined: Tue Dec 28, 2004 6:47 am
Posts: 6747
Reply with quote
Post 
Relative paths work to my knowledge.

. == current dir
.. == up one dir

_________________
Continuing FF4 Research...


Fri Apr 13, 2007 5:30 am
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Reply with quote
Post 
I believe current SVN has every kind of path even relative working properly now. Although I haven't tested Windows myself. I'll test Windows a bit later to make sure no Windows stupidity is screwing up my beloved path system.

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Fri Apr 13, 2007 8:24 am
Profile WWW
New Member

Joined: Fri Apr 13, 2007 3:06 am
Posts: 4
Reply with quote
Post 
They work fine, if you know what to do.

It's just not well documented how to do something common like saving to a directory next to zsnes.exe instead of dumping files with the roms.

One dot is current directory. No dots does nothing, and gives a vague error message when you try to save.


Fri Apr 13, 2007 8:27 am
Profile
Veteran
User avatar

Joined: Wed Jul 28, 2004 8:54 am
Posts: 603
Reply with quote
Post 
Pure Pandemonium wrote:
They work fine , if you know what to do.

It's just not well documented how to do something common like saving to a directory next to zsnes.exe instead of dumping files with the roms.

One dot is current directory. No dots does nothing , and gives a vague error message when you try to save.

I haven't tested , but if relative paths are *properly* implemented , "\SAVE" should go to a "SAVE" folder located directly on the root of the current drive (wherever ZSNES was executed from). It should not give you an error message unless the folder does not exist or is inaccessible. I wouldn't expect that message to be "vague", though I'll have to try it and see what it actually says. If it does give an error, and the folder exists and is accessible, then relative paths are not properly implemented. The initial slash is synonymous with "root directory". This is why CD \SAVES\ will switch to that folder from the command line no matter which folder is currently occupied (as long as the current drive is the correct one). This is not specific to windows. It's not only a Windows thing either. CD / works to go to the root of an FTP , indicating that UNIX and other systems equate a starting slash to mean "root". I tested the command-line FTP client with Windows XP:

[Win]+[R] , cmd , [ENTER]
ftp ftp.mozilla.org , [ENTER]
anonymous , [ENTER] (username)
[ENTER] (blank password)
cd pub/mozilla.org/firefox/releases/latest/win32/en-US , [ENTER]
ls , [ENTER]
get "Firefox Setup 2.0.0.3.exe" , [ENTER] (closing quote not actually required)
cd /pub/mozilla.org/thunderbird/releases/latest/win32/en-US , [ENTER] - Did anyone see what I just did there? ;)
ls , [ENTER]
get "Thunderbird Setup 1.5.0.10.exe" , [ENTER] (Again the closing quote is not actually required)
bye , [ENTER]
start . , [ENTER]
exit , [ENTER]

Works like a charm...

The root slash work great in HTML also:
Code:
<HTML>
<A HREF="/images/fullscreen/penis.jpg">
<IMG SRC="/images/thumbnails/kittens.jpg">
<BR>Click for wallpaper-size image!
</A>
</HTML>


Both of these examples use Unix style paths, but it's the same principle for local paths on Windows, only with a "" for local paths instead of a "/".

[edit]
Slightly edit'd

_________________
Need a new sig...


Last edited by Ichinisan on Sun Apr 15, 2007 2:07 am, edited 2 times in total.



Sat Apr 14, 2007 11:48 pm
Profile
New Member

Joined: Fri Apr 13, 2007 3:06 am
Posts: 4
Reply with quote
Post 
Thank you for the research and in-depth reply.

I vaguely remember not having hassles with this with on an earlier version of ZSNES, but I wasn't confident enough to report it as a bug, and didn't think to test an earlier release.


Looks like it's been broken (in windows, at least). \SAVE\ works fine on 1.42, and gives an Unable To Save message on 1.50 and 1.51.


Sun Apr 15, 2007 12:58 am
Profile
"God"

Joined: Tue Jul 27, 2004 11:24 pm
Posts: 1128
Reply with quote
Post 
relative paths do not start with a \ or a /

_________________
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.


Sun Apr 15, 2007 1:17 am
Profile
ZSNES Developer
ZSNES Developer

Joined: Tue Dec 28, 2004 6:47 am
Posts: 6747
Reply with quote
Post 
funkyass wrote:
relative paths do not start with a \ or a /


We have a winner.

Pure Pandemonium wrote:
Thank you for the research and in-depth reply.

I vaguely remember not having hassles with this with on an earlier version of ZSNES, but I wasn't confident enough to report it as a bug, and didn't think to test an earlier release.


Looks like it's been broken (in windows, at least). \SAVE\ works fine on 1.42, and gives an Unable To Save message on 1.50 and 1.51.


That's because that 1.42 paths is more broken than you think and that you are misunderstanding relative paths.

"\SAVES" does mean root path (generally C:) attached to the listed path (in other words, that is translated into C:\SAVES in this instance).

_________________
Continuing FF4 Research...


Last edited by Deathlike2 on Sun Apr 15, 2007 1:30 am, edited 4 times in total.



Sun Apr 15, 2007 1:19 am
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Reply with quote
Post 
If you're getting unable to save message with a path of "\save", then I doubt you have a directory called "save" in the root of your current drive with write permission.

If you wanted a relative path for save in the current directory you want one of these four:
save
save\
.\save
.\save\

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Sun Apr 15, 2007 1:20 am
Profile WWW
Veteran
User avatar

Joined: Wed Jul 28, 2004 8:54 am
Posts: 603
Reply with quote
Post 
funkyass, All: A path beginning with a slash *is* "relative". It is relative to the drive that you are working from and not the directory.

Yup. 8)

_________________
Need a new sig...


Sun Apr 15, 2007 2:02 am
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Reply with quote
Post 
Ichinisan wrote:
funkyass, All: A path beginning with a slash *is* "relative".

Incorrect.

It may only be correct when quantified with there being multiple root directories.

However even on a system like DOS or Windows which has multiple root directories, many would deem the root path to be absolute irregardless of the fact that there are drives.

Relative Path is defined thus: "A relative path is a path relative to the current working directory". On DOS/Windows since there are multiple working directories, you figure it out. The topic in this instance is debatable at best.

Furthermore, a user is wondering why .\save works and not \save, surely even you can tell the difference.

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Sun Apr 15, 2007 2:24 am
Profile WWW
New Member

Joined: Fri Apr 13, 2007 3:06 am
Posts: 4
Reply with quote
Post 
Nach wrote:
If you're getting unable to save message with a path of "\save", then I doubt you have a directory called "save" in the root of your current drive with write permission.

If you wanted a relative path for save in the current directory you want one of these four:
save
save\
.\save
.\save\


OK. "\save" does write to a "c:\save" folder if I make one. But "save" fails to do anything as far as I can tell.

I can't try "save" nor ".\save" as ZSNES adds a trailing slash.

Whichever way the program works, I suggest the docs help explain how to put save files into a directory next to the exe.


Sun Apr 15, 2007 4:42 am
Profile
ZSNES Developer
ZSNES Developer

Joined: Tue Dec 28, 2004 6:47 am
Posts: 6747
Reply with quote
Post 
Pure Pandemonium wrote:
Nach wrote:
If you're getting unable to save message with a path of "\save", then I doubt you have a directory called "save" in the root of your current drive with write permission.

If you wanted a relative path for save in the current directory you want one of these four:
save
save\
.\save
.\save\


OK. "\save" does write to a "c:\save" folder if I make one. But "save" fails to do anything as far as I can tell.[/qu

I can't try "save" nor ".\save" as ZSNES adds a trailing slash.

Whichever way the program works, I suggest the docs help explain how to put save files into a directory next to the exe.


That's probably because you didn't create the folder first.

Besides, that's not as useful to explain it, as you need to know how relative paths work before attempting it in the first place.

Also, make sure to hit the enter/return key when done entering the path. This is the most important step.

Just in case you are still not clued in, "save" or ".\save" implies "(ZSNES executable location)\Save". I've already tested it.

_________________
Continuing FF4 Research...


Sun Apr 15, 2007 5:14 am
Profile
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3901
Location: Solar powered park bench
Reply with quote
Post 
Pure Pandemonium wrote:
I can't try "save" nor ".\save" as ZSNES adds a trailing slash.

You did just try it. As you found out, ZSNES converts it, so "save" == "save".

In any event, you want to make sure you created the path you entered.

_________________
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding


Sun Apr 15, 2007 11:31 am
Profile WWW
Rookie

Joined: Fri Jan 13, 2006 7:01 pm
Posts: 23
Reply with quote
Post 
Nach wrote:
Ichinisan wrote:
funkyass, All: A path beginning with a slash *is* "relative".

Incorrect.

It may only be correct when quantified with there being multiple root directories.

However even on a system like DOS or Windows which has multiple root directories, many would deem the root path to be absolute irregardless of the fact that there are drives.

Relative Path is defined thus: "A relative path is a path relative to the current working directory". On DOS/Windows since there are multiple working directories, you figure it out. The topic in this instance is debatable at best.

Furthermore, a user is wondering why .\save works and not \save, surely even you can tell the difference.


Oh it is indeed relative. You could argue that it is relative to the drive and not the directory, but the drive is also relative to the directory and you are telling the commandline to switch to the drive root that is relative to the current directory. If you were in "C:\Program Files\Microsoft\." and you wanted to switch to "C:\DOWNLOAD\SNES\." , You could do it by typing "CD\DOWNLOAD\SNES" and hitting ENTER. If you were working on a different drive and you wanted to change the working directory of C:\, you would have to use a full path (the command prompt will stay the same until you switch drives when you will then see that it did indeed change working directories on the other drive).

Once again, though "" is relative to the drive root, it is also relative to the current working directory because the directory is also relative to the drive.

_________________
McAffee says ZSNES has a virus in it!*nt*
im glad u think its funny a**hole o wate no im not go 2 hell


Mon Apr 23, 2007 10:15 pm
Profile
"God"

Joined: Tue Jul 27, 2004 11:24 pm
Posts: 1128
Reply with quote
Post 
"\" isn't relative to anything - its a character that's used to define directories in a file path - its also the general synonym for a file system's root directory when used either by itself or at the start of a local file path.

its better to think of a relative path as one that starts with the current working directory in transversing the file system. Microsoft throws a wrench into this with its drive letters, as there OS's lack the concept of a single root for file systems - so a file on a: will never be relative to a file on c:, since they don't share a common root.

_________________
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.


Tue Apr 24, 2007 12:26 am
Profile
Rookie

Joined: Fri Jan 13, 2006 7:01 pm
Posts: 23
Reply with quote
Post 
funkyass wrote:
"" isn't relative to anything - its a character that's used to define directories in a file path - its also the general synonym for a file system's root directory when used either by itself or at the start of a local file path.

its better to think of a relative path as one that starts with the current working directory in transversing the file system. Microsoft throws a wrench into this with its drive letters, as there OS's lack the concept of a single root for file systems - so a file on a: will never be relative to a file on c:, since they don't share a common root.


Yes it is relative to something; no it isn't simply used to define directories in a path. "CD" will always take you to the root of the drive you are working with. The drive you are working with is relative. The "" between directory names it more than a seperator: It denotes the root of each directory. If I wanted my program to dump a log on the root of whatever drive it was executed from, telling it to write the file to the "" directory would do the trick. No need to specify drive letters that may not be the same across different systems. It's relative to the path executed from, so it's relative.

_________________
McAffee says ZSNES has a virus in it!*nt*
im glad u think its funny a**hole o wate no im not go 2 hell


Tue Apr 24, 2007 1:21 pm
Profile
"God"

Joined: Tue Jul 27, 2004 11:24 pm
Posts: 1128
Reply with quote
Post 
did you read the second paragraph?

_________________
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.


Tue Apr 24, 2007 10:22 pm
Profile
Dark Wind
User avatar

Joined: Thu Jul 29, 2004 8:58 pm
Posts: 1270
Location: Texas
Reply with quote
Post 
funkyass wrote:
its better to think of a relative path as one that starts with the current working directory in transversing the file system. Microsoft throws a wrench into this with its drive letters, as there OS's lack the concept of a single root for file systems - so a file on a: will never be relative to a file on c:, since they don't share a common root.


Windows (2000 and later, AFAIK) actually does have mount points of some sort. I've never tried them, but supposedly you actually could have everything under C:\.

_________________
#577451


Tue Apr 24, 2007 10:33 pm
Profile WWW
Lurker

Joined: Tue Apr 10, 2007 4:30 pm
Posts: 152
Location: Sweden
Reply with quote
Post 
What he means is that windows nt+ can mount volumes in directories just like posix can.

Also, I think that relative path must be explicitly defined from where they are relative. As in the docs must say what folder "." is for the paths, the cd of the invokement(or as set in the shortcut files on windows), the place of the rom file, the zsnes installpath(possibly different from invocation dir) or the user's home dir.


Wed Apr 25, 2007 7:55 pm
Profile WWW
New Member

Joined: Mon Dec 25, 2006 12:35 am
Posts: 7
Reply with quote
Post 
hi allz !

I was using Windows for a while, but now I use Ubuntu Linux...


I got all my save in the same directory as my roms :

gedit zsnesl.cfg wrote:
; ROMs directory
ROMPath="/media/sda4/Jeux - emulation/nintendo_snes/roms/Mr Nutz/"

Folder "Mr Nutz" contains "Mrnutz.smc", "Mrnutrz.zs1", etc...

Quote:
; Save states & SRAMs, snapshots, SPCs
SRAMPath="./"
SnapPath="./"
SPCPath="./"


I tryed "." "/" "" "save" "." "./" " " for SRAMPath="./" but nothing works !! I can't see my saves... :/

Thank U in advance !!


Tue May 01, 2007 8:14 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 22 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.