Giter VIP home page Giter VIP logo

Comments (9)

lautis0503 avatar lautis0503 commented on May 20, 2024 1

_splitpath and _splitpath_s can only handle full path correctly, but you give it ".". So the path is broken.
I will try to fix this.

You are using tinydir_file_open, which is for opening a single file. But "." in Windows should be a folder. It's not recommended. Instead you can use tinydir_open.
And tinydir_open can handle path ".".

from tinydir.

cxong avatar cxong commented on May 20, 2024

It would be best if tinydir_file_open detected this and returned an informative error like ENOENT or EINVAL (if . is never a valid filename).

from tinydir.

lautis0503 avatar lautis0503 commented on May 20, 2024

@cxong Though "." may not be a valid file name, it could be good to return 0 as file.is_dir is set.
The point is _splitpath_s.
Here in VS 2010, _splitpath_s will make drive_buf and dir_name_buf full of messy code when using widechar, but not gcc.
So we need to fix this.

from tinydir.

lautis0503 avatar lautis0503 commented on May 20, 2024

@cxong Sorry to say that although _splitpath_s is not working fine, the tinydir_file_open itself are buggy. Whatever path it is, tinydir_file_open will always exit with Run-Time Failure #2 with _splitpath_s and widechar. Don't know why.

from tinydir.

lautis0503 avatar lautis0503 commented on May 20, 2024

@staticlibs Try #40

from tinydir.

staticlibs avatar staticlibs commented on May 20, 2024

@lautis0503 , about tinydir_open - I want to open a file and check whether it is a regular file or directory, get its name etc. tinydir_file_open is probably a right method for it.

Header updated with #40 worked for me in smoke testing after fixing the typo on line 630 (unneeded sizeof near ext_buf). Though specified sizes are probably incorrect there as they exceed the ones allowed in _wsplitpath_s - https://msdn.microsoft.com/en-us/library/8e46eyt7.aspx#Anchor_3 , from there - "File components larger than the corresponding manifest constants cause heap corruption."

Thanks for the fix!

from tinydir.

lautis0503 avatar lautis0503 commented on May 20, 2024

@staticlibs It is the right method.
@cxong _TINYDIR_PATH_MAX is too large for _splitpath. Maybe we need to write a function manually. What's your opinion?

from tinydir.

cxong avatar cxong commented on May 20, 2024

I guess _TINYDIR_PATH_MAX should be MAX_PATH instead for windows, which is 260 and doesn't break _splitpath. I originally used 4096 just because it was the limit for linux and didn't think it hurt to have it larger than necessary.

from tinydir.

lautis0503 avatar lautis0503 commented on May 20, 2024

OK. I've done that.

from tinydir.

Related Issues (20)

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.