Solved

Api or delphi function to have the previous directory

Posted on 1999-01-18
3
151 Views
Last Modified: 2010-04-04
Hi,
I want to know if a function or api exist to retreive the previous directory with a string like: 'c:\yes\itsok\'?
Thanks
0
Comment
Question by:mabell
3 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1362412
What do you mean with the previous directory?

Perhaps you mean "ExtractFilePath"? Or "GetCurrentDir"?

Regards, Madshi.
0
 

Author Comment

by:mabell
ID: 1362413
I mean a function or api similar to extractfilepath but instead of cuting the file name
it cut the second directory. Exemple:  You call this   TheFunctionName('c:\temp1\temp2\')
and obtain this 'c:\temp1\' .
Thanks.
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1362414
This will do it...

function TheFunctionName(Path : string) : String;

begin
  if Path[length(path)] = '\' then
    Path := copy(path, 1, length(path) - 1);

  result := ExtractFilePath(Path);
end;

Cheers,

Raymond.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question