[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Real simple question about strings...
- From: Sean Conner <sean@...>
- Date: Wed, 16 Jun 2010 04:06:05 -0400
It was thus said that the Great firstname.lastname@example.org once stated:
> I'm having a serious brain fart here.. I start off with a string that
> holds a file path, something like aFilePath =
> "c:\\a\\b\\c\\d\\filename.blah.. As I pass it around in Lua, it
> removes the \ and becomes C:\a\b\c.. and so on.. Now I save the
> filepath to a file, it gets saved as C:\a\b\c\d etc.. without the
> added \\... now when i try to load up the file, I loose all \'s,
> obviously because it think's these are escape sequences now... I
> shouldn't have to replace these all the time with \\ ... how can I
> keep the file path intact between saves and loads etc?
Little known, but Windows does support '/' as a path separator in addition
to '\'. To windows,
are the same. This doesn't apply to the shell (CMD.EXE these days, CMD.COM
back in the MS-DOS days) but the underlying APIs will accept either '/' or
'\'. This has been the case since MS-DOS 2.0.
-spc (So I would try it with forward '/' slashes and see if that works)