Personal tools

FilePath

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Thoughts/Todo)
(Update with contents of note as of April 2007)
 
(14 intermediate revisions by 5 users not shown)
Line 9: Line 9:
 
System.FilePath and it will pick the right one. Of course, if you
 
System.FilePath and it will pick the right one. Of course, if you
 
demand Windows paths on all OS's, then System.FilePath.Windows will
 
demand Windows paths on all OS's, then System.FilePath.Windows will
give you that (same with Posix). Written in Haskell 98 + Heirarchical
+
give you that (same with Posix). Written in Haskell 98 + Hierarchical
 
Modules.
 
Modules.
   
* Homepage: http://www-users.cs.york.ac.uk/~ndm/projects/libraries.php
+
* Haddock: http://www-users.cs.york.ac.uk/~ndm/projects/filepath/System-FilePath.html
+
*Home page: http://www-users.cs.york.ac.uk/~ndm/filepath/
* Darcs: darcs get http://www.cs.york.ac.uk/fp/darcs/filepath
+
*Darcs repo: http://darcs.haskell.org/packages/filepath/
* Source: http://www.cs.york.ac.uk/fp/darcs/filepath/System/FilePath.hs
+
*Haddock: http://www.cs.york.ac.uk/fp/haddock/filepath/
* Readme: http://www.cs.york.ac.uk/fp/darcs/filepath/readme.txt
 
   
 
If you go to the haddock page there are a few little examples at the
 
If you go to the haddock page there are a few little examples at the
Line 23: Line 23:
 
this module succesfully.
 
this module succesfully.
   
Comments welcome. Thanks
+
==Version 1.0 release==
+
Finally, here is a System.FilePath 1.0 release! The FilePath library
== Thoughts/Todo ==
+
is a library for manipulating FilePaths in a cross platform way on
+
both Windows and Unix.
For that there would need to
+
This version will be included in GHC 6.6.1 and all future major
be some FilePath function such as checkDownstream :: FilePath ->
+
Haskell compilers.
FilePath -> Bool which checks if some path is below another in the
 
tree. I'll think about adding that one.
 
 
> I guess you mean "makeValid" replaces them with underscores. That wasn't
 
> clear in the documentation but I understand what you are trying to do now.
 
I'll make the docs clearer - I have done a lot of work on them this
 
weekend, but its not quite clear how makeValid works even still -
 
certainly worth a fix.
 
 
\\?\ should be a drive, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp
 
   
Another thing I thought of would be a "canonicalPath" IO action (canonicalPath :: FilePath -> IO FilePath) that returns a FilePath that implements case-preserving-case-insensitive matching. For example, if there is a file named "Hello There.txt" in C:\, then
+
'''THINGS TO NOTE:'''
(canonicalPath "c:\hello there.txt ") would give "C:\Hello There.txt").
 
   
== Thoughts on FilePath as a abstract type ==
+
*There are no longer Version_0_10 interfaces - the interface is now stable, please use System.FilePath.
  +
*The library is now "filepath", not "FilePath"
   
Add them here :)
+
[[Category:Libraries]]

Latest revision as of 18:31, 23 June 2007

I have written a System.FilePath module in part based on the one in Yhc, and in part based on the one in Cabal (thanks to Lemmih). The aim is to try and get this module into the base package, as FilePath's are something many programs use, but its all too easy to hack up a little function that gets it right most of the time on most platforms, and there lies a source of bugs.

This module is Posix (Linux) and Windows capable - just import System.FilePath and it will pick the right one. Of course, if you demand Windows paths on all OS's, then System.FilePath.Windows will give you that (same with Posix). Written in Haskell 98 + Hierarchical Modules.


If you go to the haddock page there are a few little examples at the top of the file.

The Yhc project, hquickfile and a few other utilites are already using this module succesfully.

[edit] Version 1.0 release

Finally, here is a System.FilePath 1.0 release! The FilePath library is a library for manipulating FilePaths in a cross platform way on both Windows and Unix. This version will be included in GHC 6.6.1 and all future major Haskell compilers.

THINGS TO NOTE:

  • There are no longer Version_0_10 interfaces - the interface is now stable, please use System.FilePath.
  • The library is now "filepath", not "FilePath"