Version française
Home     About     Download     Resources     Contact us    
Browse thread
absolute_name ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: absolute_name ?

Is this the best (and only) way to get the absolute name to a file in a way that would work on all 
system (windonws, OS X, unix, ...) ?


let absolute_name str =
   let base = Filename.basename str in
   let dir = Filename.dirname str in
   let saved_dir = Sys.getcwd () in
   Sys.chdir dir;
   let res = Filename.concat (Sys.getcwd ()) base in
   Sys.chdir saved_dir;
   res

I find this a bit complicated, so I may be missing some functions in Sys, Filename or some other lib ...

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------