Page 1 of 1
parent directory
Posted: Fri May 24, 2024 8:35 pm
by ilbarbax
Missing a command returning the parent directory of a given path complying with the canonize style.
Re: parent directory
Posted: Sun May 26, 2024 8:00 pm
by ilbarbax
Sorry i posted it in the wrong whishlist
Re: parent directory
Posted: Sun May 26, 2024 9:08 pm
by airsoftsoftwair
ilbarbax wrote: ↑Fri May 24, 2024 8:35 pm
Missing a command returning the parent directory of a given path complying with the canonize style.
Hmm, what exactly are you trying to do? This works here and prints the full path of the parent directory:
Of course you could also pass another path to
CanonizePath() and append ".." to specify a parent directory.
Re: parent directory
Posted: Tue May 28, 2024 9:09 pm
by ilbarbax
No I have a string with a path i.e. "C:/Barba/MieiProgrammi/icons/fiw/" and I want the parent directory of that string then "C:/Barba/MieiProgrammi/icons/"
As far as I intend the command you suggested works on the current path of the program, but I do not want to change it.
actually I have solved it in such way but obviously I also have to manage it differently on the different os's
Local aa,cn=SplitStr(nome_dir$,slash$)
nome_dir$=""
For Local t=0 To cn-3
nome_dir$=nome_dir$..aa[t]..slash$
Next
Re: parent directory
Posted: Wed May 29, 2024 8:25 am
by jPV
Or something like this:
Code: Select all
PathPart(TrimStr(dir$, "/", True))
Re: parent directory
Posted: Wed May 29, 2024 10:15 am
by Flinx
Why don't you like Andreas' second option?
It works if the path exists.
Code: Select all
dir$="C:/Barba/MieiProgrammi/icons/fiw/"
DebugPrint(CanonizePath(dir$..".."))
Re: parent directory
Posted: Wed May 29, 2024 2:37 pm
by ilbarbax
it works thanks. I was unable to understand such fine tuning from the help or per my limited skill