parent directory

Feature requests for future versions of Hollywood can be voiced here
Post Reply
ilbarbax
Posts: 124
Joined: Thu Apr 01, 2010 6:41 pm

parent directory

Post by ilbarbax »

Missing a command returning the parent directory of a given path complying with the canonize style.
ilbarbax
Posts: 124
Joined: Thu Apr 01, 2010 6:41 pm

Re: parent directory

Post by ilbarbax »

Sorry i posted it in the wrong whishlist
User avatar
airsoftsoftwair
Posts: 5471
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: parent directory

Post 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:

Code: Select all

DebugPrint(CanonizePath(".."))
Of course you could also pass another path to CanonizePath() and append ".." to specify a parent directory.
ilbarbax
Posts: 124
Joined: Thu Apr 01, 2010 6:41 pm

Re: parent directory

Post 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
User avatar
jPV
Posts: 610
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: parent directory

Post by jPV »

Or something like this:

Code: Select all

PathPart(TrimStr(dir$, "/", True))
Flinx
Posts: 206
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: parent directory

Post 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$..".."))
ilbarbax
Posts: 124
Joined: Thu Apr 01, 2010 6:41 pm

Re: parent directory

Post by ilbarbax »

it works thanks. I was unable to understand such fine tuning from the help or per my limited skill
Post Reply