
Code : Tout sélectionner
Procedure.s RelativePath(FromPath.s,Path.s)
Protected l.w,c.w,NewPath.s
Newpath.s=""
c=0
For l=Len(FromPath) To 1 Step -1 ; On lit a l'envers
If Mid(FromPath,l,1)="\" ; A chaque fois que je trouve un nouveau repertoire on compte
c+1
If FindString(Path,Mid(FromPath,1,l),1) ; Si on retrouve alors le même chemin commun que le chemin original alors on casse la boucle
Break
EndIf
EndIf
Next l
For z=1 To c-1
Newpath+"..\"
Next
Newpath+Right(Path,Len(Path)-l)
ProcedureReturn NewPath
EndProcedure
Code : Tout sélectionner
File.s="C:\Documents And Settings\lebrun_y\Mes documents\Developpement\Planetes Aliens\MapEditor\Sfx\porte.wav"
Path.s="C:\Documents And Settings\lebrun_y\Mes documents\Developpement\Planetes Aliens\MapEditor\"
Debug RelativePath(Path,File)
