Solved

Api or delphi function to have the previous directory

Posted on 1999-01-18
3
148 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now