Thread: resolve pwd //
View Single Post
Old 06-02-2005, 04:31 PM  
neoxed
Too much time...
 
Join Date: May 2003
Posts: 1,326
Default

Quote:
Originally posted by mentality
regsub what? {/} {//} {///} {/////}

bit infalted dont u think, and im sure if it wasnt useful, it wouldnt be part of unix. but, i guess you're bored.
Last I checked, ioFTPD is written for Windows, not UNIX (or any of its equivalents). If you were to argue your point, perhaps you should reference Windows software instead. Using Windows explorer, try to access "C:\\\\\Windows" – you will find that only “C:\Windows” works (at least on XPSP2). Now of course, this behavior is not consistent with _all_ Microsoft applications.
Quote:
Originally posted by mentality
u can do:

Code:
set pwd /[string trim [string trim $pwd /]/[string trim [lrange $args 1 end] /] /]
I'm sorry, but that example code is just ugly and not practical. You could look into Tcl's 'file normalize' function, which canonicalizes the given path (beware; this function has a few subtleties).

Or even a simple regular expression replacement would suffice (as tuff mentioned):
Code:
regsub -all {[\\/]+} $dirPath {/} dirPath
neoxed is offline   Reply With Quote