|
From: Peter S. <pe...@pj...> - 2018-05-29 18:29:39
|
Use sb-ext:parse-native-namestring to create a pathname that isn't wild
On 29/05/18 18:36, Jeff Cunningham wrote:
> Greetings;
>
> I ran into a situation where probe-file is failing on some filenames.
> These are valid files which can be opened and manipulated in various
> ways by other lisp functions, but probe-file thinks they are wild and
> fails. Here's an example:
>
> (probe-file "[Video] Raag Khamaj.mp3")
>
> can't find the TRUENAME of wild pathname
> /home/jcunningham/music/[Video] Raag Khamaj.mp3(physicalized from
> [Video] Raag Khamaj.mp3).
> [Condition of type SB-INT:SIMPLE-FILE-ERROR]
>
> Restarts:
> 0: [ABORT] Abort compilation.
> 1: [*ABORT] Return to SLIME's top level.
> 2: [ABORT] abort thread (#<THREAD "worker" RUNNING {10040C1773}>)
>
> Backtrace:
> 0: (SB-IMPL::QUERY-FILE-SYSTEM "[Video] Raag Khamaj.mp3" :TRUENAME NIL)
>
> I gather that this is expected behavior for SBCL. wild-pathname-p
> returns true. I can't change the filenames. To get around this I could
> escape the brackets:
>
> (probe-file "\\\[Video\\\] Raag Khamaj.mp3") ==> #P"/tmp/\\[Video]
> Raag Khamaj.mp3"
>
> But searching for brackets and modifying strings doesn't seem like a
> very efficient solution. So my question is: how should one test for
> existence of files whose names have brackets in them?
>
> --Jeff
>
>
>
> ------------------------------------------------------------------------------
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Sbcl-help mailing list
> Sbc...@li...
> https://lists.sourceforge.net/lists/listinfo/sbcl-help
|