Recent

Author Topic: How to interpret ../../directory and construct absolute path?  (Read 1813 times)

stem

  • Jr. Member
  • **
  • Posts: 88
Hi,

let the variable subdirectory be, for example, "sound", so in my program the filename is put together like:

Code: [Select]
filename := subdirectory + DirectorySeparator + 'test.mp3';

(relatively to the current directory)

How can I support values like "../../sound" for subdirectory, i.e. go two directories up and then go to subdirectory "sound"?

Thank you!


stem

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: How to interpret ../../directory and construct absolute path?
« Reply #1 on: May 05, 2018, 01:29:55 am »
Use ExpandFileName from unit sysutils.

 

TinyPortal © 2005-2018