Comments (8)
Try uiop:native-namestring
from cl-fad.
cl-fad is a wrapper around the CL pathname system, and the CL pathname system is not able to deal with all possible file names that can occur. It is a portability wrapper around different file systems, and it only works reliably for files that one creates using it. Files with arbitrary path names created with other programs, or even with CL using non-portable characters in the name are causing portability problems, and cl-fad is not going to fix that. If you need to deal with arbitrary file names, don't use CL pathnames for it. One way to do this is by using IOlib.
If you have a fix for your problem in cl-fad, please submit a pull request.
from cl-fad.
As I understand it, the [ and ] characters are valid in all filesystems (see https://en.wikipedia.org/wiki/Filename for example). It is reasonable to expect cl-fad to handle valid characters in filenames.
I will see what I can do about fixing it, although I was hoping someone more qualified from the cl-fad team could do it better.
from cl-fad.
Random Wikipedia pages are not a credible source to support your case.
When CL was created, different file systems were in common use and its pathname system is meant to support these. VMS, for example, would use path names like FOO::BAR$BAZ:[DIRECTORY.SUB-DIRECTORY]FILE-NAME.EXT;234
and Common Lisp would gladly support that.
from cl-fad.
And I thought correctness was something all Lisp programmers were concerned with.
Sorry, Hans, I guess VMS pathnames should be supported, but Linux, Windows and Apple - not so much.
By the way, cl-fad would read your VMS path as FOO::BAR$BAZ:[DIRECTORY.SUB-DIRECTORY]FILE-NAME.EXT;234 and choke.
from cl-fad.
Well, the thing is, cl-fad is working without issues with [ in pathnames coming from list-directory. And nothing in cl-fad or SBCL has changed recently in that area to affect it. So you are either misinterpreting your findings or are not showing us your complete test cases.
from cl-fad.
@stacksmith I'm personally not interested in making cl-fad support funny characters in file names, because it would be a never-ending effort and I don't have the need for it. This has nothing to do with correctness, but with motivation. It helps to understand the history of CL to understand why the pathname system has difficulties with file names that contain characters which are considered to be delimiters in other, maybe obsolete or ancient systems. Your remark regarding "cl-fad"'s "inability" to correctly parse a VMS file name is besides the point, because you're not running on VMS. If you were running cl-fad on a CL implementation on VMS and it would fail to support a native VMS path, you'd have a bug to report.
Stas seems to have a different take and motivation and have questions regarding what you reported as a bug, so I'm leaving it up to him to send any further responses.
from cl-fad.
stassats, thank you for your reply. My software needs to handle filenames I have no control over, and on further investigation it appears that cl-fad is not at fault. Paths with double-backslash-open-brace can be opened inside Lisp. However, they are not displayed correctly and cannot be passed as parameters to outside applications. I understand if you feel that it is not a problem of cl-fad.
Do you have any suggestions for a clean way of creating a correct visual representation of a path (allowing the user to spell it out and still find the file in the file manager, for instance) as well as a string representation that could be passed outside to the OS?
I'd hate to have to yank backslashes out of the pathstring for this one case - and who knows what other cases there are...
Thanks
Perhaps I am misunderstanding the mission statement of cl-fad: "It is intended to provide some
unification between current CL implementations on Windows, OS X, Linux, and Unix." My assumption was that the unification means the ability to deal with pathnames allowed by the host OS for applications such as scripting and file managers (which require dealing with native files)
from cl-fad.
Related Issues (20)
- :description
- please keep cl-test-grid informed about testsuite changes
- WITH-OPEN-TEMPORARY-FILE not working on Windows HOT 2
- Asymmetry between directory-exists-p and directory-pathname-p HOT 1
- list-directory replaces [ characters in filenames with \\[, resulting in an extra slash... HOT 2
- error in `list-directory` when encountering a broken symlink HOT 1
- merge temporary-files HOT 5
- Suggestion to prevent infinite loops when traversing HOT 1
- get-default-temporary-directory returns a truename containing :unspecified on LispWorks
- Copy directory recursively HOT 6
- WITH-TEMPORARY-DIRECTORY ?
- add truenameize from asdf HOT 1
- The test compares truename with non-truenames HOT 2
- Bug in PATHNAME-AS-DIRECTORY HOT 5
- Generate random temporary folder HOT 2
- Build error for lispworks HOT 2
- CMUCL regression in cl-fad 0.7.0 HOT 1
- Minor issue with the homepage download link
- CentOS 6 compatibility HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cl-fad.