function ParentDir(ChildDir: string):string;
var
i: integer;
begin
for i := Length(ChildDir) downto 1 do
begin
if ChildDir = '/' then
break;
end;
result := copy(ChildDir,1,i);
end;
有这个函数吧
function ParentDir(ChildDir: string):string;
var
i: integer;
source:string;
begin
source:=childdir;
if pos(':/',lowercase(childdir))>0 then
System.Delete(childdir, 1, 4);
i := Pos('/', childdir);
result :=copy(source,1,i+4);
end;
var
new_path,old_paht:string;
begin
old_path:=ExtractFilePath(Application.ExeName);
While pos('/',old_path)<>0 do
begin
new_path:=new_path+copy(old_ath,1,pos('/',old_path));
delte(old_ath,1,pos('/',old_path));
end;
end;