View previous topic :: View next topic |
Author |
Message |
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Thu Jul 22, 2010 10:25 am Post subject: [PS2] New basename and dirname implementations for ps2sdk |
|
|
I guess I only scratched the surface when I did these before, but now they work pretty well. I made them more PS2-specific so it treats device specifiers/mount points as directories, works with slashes at the end of the path, multiple slashes, and such. It also works with standard Unix paths and Windows paths.
There might still be a corner case here or there that doesn't work. The only cases I know are strings containing multiple device specifiers or colons.
Code: |
Results:
path = "/"
basename = "/"
dirname = "/"
path = "¥"
basename = "¥"
dirname = "¥"
path = ":"
basename = "."
dirname = "."
path = "mass0:"
basename = "."
dirname = "mass0:"
path = "mass0:/"
basename = "."
dirname = "mass0:/"
path = "mass0:something"
basename = "something"
dirname = "mass0:"
path = "mass0:/something"
basename = "something"
dirname = "mass0:/"
path = "mass0:something/"
basename = "something"
dirname = "mass0:"
path = "mass0:/something/"
basename = "something"
dirname = "mass0:/"
path = "mass0:something/is"
basename = "is"
dirname = "mass0:something"
path = "mass0:/something/is"
basename = "is"
dirname = "mass0:/something"
path = "mass0:/something/is/"
basename = "is"
dirname = "mass0:/something"
path = "mass0:/something/is/there"
basename = "there"
dirname = "mass0:/something/is"
path = "mass0:/something/is/there/"
basename = "there"
dirname = "mass0:/something/is"
path = "mass0:/something/is/there//"
basename = "there"
dirname = "mass0:/something/is"
path = "mass0:/something/is//there//"
basename = "there"
dirname = "mass0:/something/is"
path = "mass0:/something//is//there//"
basename = "there"
dirname = "mass0:/something//is"
|
New Patch:
http://github.com/ragnarok2040/ps2sdk/commit/6b92a95c24a615ea437c1fb7855d61ff7830f2cb
Last edited by ragnarok2040 on Wed Aug 04, 2010 12:29 am; edited 3 times in total |
|
Back to top |
|
|
misfire
Joined: 06 Sep 2004 Posts: 120 Location: Germany
|
|
Back to top |
|
|
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Fri Jul 23, 2010 2:42 am Post subject: |
|
|
Thanks :D.
I knew of pastebin.com, but there was a symbol they used that caused diffs to be displayed wrong. I think it was @@. That may not be true any longer since the redesign, however.
Pastie.org looks nice, though, so I'll use that in the future, :D.
Edit:
I noticed a special case where paths like mass0:/something/ or mass0:\\something\\ would strip the slash or backslash after the device specifier so I updated the patch. |
|
Back to top |
|
|
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Wed Aug 04, 2010 4:34 am Post subject: |
|
|
Apparently you can add ".diff" to that github URL to get a properly formatted patch. Nice. I applied this to ps2dev svn. |
|
Back to top |
|
|
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Wed Aug 04, 2010 6:22 pm Post subject: |
|
|
Nice, I didn't know that :D.
I've done quite a few commits over the past week or so but there's a couple I consider unstable. I'll make a new post and make a list of patches that should be included. |
|
Back to top |
|
|
|