
000001| (**

000002| This program is free software; you can redistribute it and / or modify

000003| it under the terms of the GNU General Public License as published by

000004| the Free Software Foundation; version 3 of the License.

000005|

000006| This program is distributed in the hope that it will be useful,

000007| but WITHOUT ANY WARRANTY; without even the implied warranty of

000008| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

000009| GNU General Public License for more details.

000010|

000011| Filename utilities

000012|

000013| @author Tony BenBrahim < tony.benbrahim at gmail.com >

000014|

000015| *)

000016|

000017| (**

000018| converts a relative filename and path into an absolute filename

000019| @param dir relative of absolute path

000020| @param filename

000021| @return absolute path of file

000022| *)

000023| let resolve_filename dir filename =

000024| (*[20]*)let rec cleanup check ok =

000025| (*[184]*)let right = Filename.basename check in

000026| (*[184]*)let left = Filename.dirname check in

000027| (*[184]*)if ((*[184]*)right ="." && (*[24]*)Filename.dirname left = left) then

000028| (*[20]*)Filename.concat left ok

000029| else

000030| match right with

000031| | "." -> (*[4]*)cleanup left ok

000032| | ".." -> (*[2]*)cleanup (Filename.dirname left) ok