Code Monkey home page Code Monkey logo

Comments (7)

ndmitchell avatar ndmitchell commented on May 6, 2024 1

Thanks for the diff @andreasabel - unfortunately you've caught me as I'm travelling and otherwise unavailable. Hopefully will take a proper look at this tomorrow.

from filepattern.

ndmitchell avatar ndmitchell commented on May 6, 2024 1

@andreasabel 0.1.3 now released with this fix

from filepattern.

andreasabel avatar andreasabel commented on May 6, 2024

Relevant code:

isFile <- whenMaybe (stepDone yes /= [] && stepDone no == []) (doesFileExist path)
case isFile of
Just True -> pure [parts ++ x]
_ | StepEverything <- stepNext no -> pure []
| StepOnly [] <- stepNext yes -> pure []
| otherwise -> do
b <- if doesExist && isFile == Just False then pure True else doesDirectoryExist path
if not b then pure [] else f (parts ++ x ++ "/") yes no

In
b <- if doesExist && isFile == Just False then pure True else doesDirectoryExist path

we get isFile == Just False for a symlink, which is then treated as directory.
The docs for doesFileExist are misleading (outright wrong):
https://hackage.haskell.org/package/directory-1.3.7.1/docs/System-Directory.html#v:doesFileExist

The operation doesFileExist returns True if the argument file exists and is not a directory, and False otherwise.

from filepattern.

andreasabel avatar andreasabel commented on May 6, 2024

Since if doesExist && isFile == Just False then pure True isn't working for symlinks, we need to check doesDirectoryExist anyway, thus can get rid of the doesExist optimization altogether. Implemented in:

from filepattern.

andreasabel avatar andreasabel commented on May 6, 2024

Ping @ndmitchell.

from filepattern.

andreasabel avatar andreasabel commented on May 6, 2024

Thanks for merging! Please ping me when you release, so I can depend on the latest version.

from filepattern.

andreasabel avatar andreasabel commented on May 6, 2024

Thanks, published https://hackage.haskell.org/package/fix-whitespace-0.0.10.

from filepattern.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.