* * *

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

stem

  • New member
  • *
  • Posts: 37
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: 2109
Re: How to interpret ../../directory and construct absolute path?
« Reply #1 on: May 05, 2018, 01:29:55 am »
Use ExpandFileName from unit sysutils.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus