GithubHelp home page GithubHelp logo

Comments (11)

ynedelec3 avatar ynedelec3 commented on September 2, 2024

sys files seem to need being left apart when building the paths vector with directory_iterator (dialo-file.cpp line 256)

from irritator.

ynedelec3 avatar ynedelec3 commented on September 2, 2024

This works with the original sort function :

void copy_files_and_directories(const std::filesystem::path& current_path)
    {
        std::error_code err;
        for (std::filesystem::directory_iterator it(current_path, err), et;
             !err && it != et;
             ++it) {

            std::string sit = it->path().string();         // Nedelec
            if (sit.find(".sys") != -1)        // Nedelec
                continue; // Nedelec

            if (it->is_directory(err) && !err) {
                paths.emplace_back(*it);
                continue;
            }

            if (it->is_regular_file(err) && !err) {
                if (have_good_extension(*it) &&
                    have_good_file_name_starts(*it)) {
                    paths.emplace_back(*it);
                    continue;
                }
            }
        }
 }

from irritator.

ynedelec3 avatar ynedelec3 commented on September 2, 2024

I found another irritating file at home -) : DumpStack.log.tmp
New successful conditions are now :

if (sit.find(".sys") != -1 || sit.find("DumpStack") != -1) { // Nedelec

I can't find a generic test which could avoid calling is_directory on these special windows files

This discussion is related but does not conclude :
https://developercommunity.visualstudio.com/t/stdfilesystemis-directory-fails-with-exception-if/787098

from irritator.

quesnel avatar quesnel commented on September 2, 2024

I cannot reproduce the problem. I think a best solution is to use std::error_code to avoid exception. Can you try the test branch ?

from irritator.

ynedelec3 avatar ynedelec3 commented on September 2, 2024

I've succesfully generated the Test branch but the management of error codes doesn't raise an error anymore when ouput directory is selected on C:, dialog now shows a blank list of directories. I guess there is a real trouble with the status associated to these special files...

from irritator.

quesnel avatar quesnel commented on September 2, 2024

I have updated the test branch. Can you test?

FWI, I force the git push, you can use git fetch origin && git reset --hard origin/test to get the patch.

from irritator.

ynedelec3 avatar ynedelec3 commented on September 2, 2024

I use git functions integrated in Visual Studio, I think I got the right test branch I can see the last changes..._

I tested but file and dir list in dialog (output directory) remains empty. File and dir list in open file dialog contains directories but it is impossible to enter in any directory listed.

from irritator.

ynedelec3 avatar ynedelec3 commented on September 2, 2024

It works if && ec or && ec1, && ec2 are suppressed after is_directory(..., ec...) -lines 286, 287, 293, 408, 426, 530, 545, 656-
I left it->is_directory(err) && !err unchanged in copy_files_and_directories
I can see in https://developercommunity.visualstudio.com/t/stdfilesystemis-directory-fails-with-exception-if/787098 and in https://eel.is/c++draft/fs.op.is.directory#2 cited by the former link, that is_directory with ec as argument has noexcept statement whereas is_dierctory with single path doesn't have

bool filesystem::is_directory(file_status s) noexcept;
1

Returns: s.type() == file_­type​::​directory.
🔗
bool filesystem::is_directory(const path& p);
bool filesystem::is_directory(const path& p, error_code& ec) noexcept;

from irritator.

quesnel avatar quesnel commented on September 2, 2024

Ok. I think I already proposed this solution in #21 (comment)

I have updated the test branch with these changes. Can you test the test branch (again...) ?

from irritator.

ynedelec3 avatar ynedelec3 commented on September 2, 2024

It works now.

I did not understand in your solution cited above that introducing error_code as second parameter would fix so simply...

from irritator.

quesnel avatar quesnel commented on September 2, 2024

Cool. Thanks for the report. I merged the branches.

from irritator.

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.