Coder Social home page Coder Social logo

Comments (8)

sagiegurari avatar sagiegurari commented on July 24, 2024

not sure i want to have recursive on everything. where it makes more sense like copy/move/remove ya, but is path newer feels a bit strange.
how about using the glob command?

handle = glob_array ./somedir/**/*.txt

for path in ${handle}
    echo ${path}
end

from duckscript.

ModProg avatar ModProg commented on July 24, 2024

how about using the glob command?

That would still result in a bit of a mouthful:

target = glob_array build/**/*
src = glob_array src/**/*

any_newer = false

for src_file in ${src}
    for target_file in ${target}
        if is_path_newer ${src_file} ${target_file}
            any_newer = true
        end
    end
end

if ${any_newer}
    # My actual behaviour
end

But in the end all I would personally need is sagiegurari/cargo-make#611 (comment)

from duckscript.

sagiegurari avatar sagiegurari commented on July 24, 2024

your code is wrong. you don't need to walk and glob both source and target.
only source.
that makes the code half the size.

from duckscript.

ModProg avatar ModProg commented on July 24, 2024

your code is wrong. you don't need to walk and glob both source and target. only source. that makes the code half the size.

Depends on whether the target folder gets touched with every build, but that is probably true in most cases.

from duckscript.

sagiegurari avatar sagiegurari commented on July 24, 2024

but you are comparing EVERY source file with EVERY target file. thats wrong. no way you need to do that.
you have
src/file1.src
src/file2.src
target/file1.bin
target/file2.bin

if you glob on both and compare all, why would comparing src/file.src with target/file2.bin will help? file1 and file2 are unrelated.

from duckscript.

ModProg avatar ModProg commented on July 24, 2024

if you glob on both and compare all, why would comparing src/file.src with target/file2.bin will help? file1 and file2 are unrelated.

Depends on your language if there is a one to one mapping of build artifacts to src files

from duckscript.

sagiegurari avatar sagiegurari commented on July 24, 2024

again, based on source you create the target files to check. you don't glob.
and i think there is no way that every source file needs to be checked against every target file.
so is newer onglobs makes, at the moment, little sense to me.
give me one use case please.

from duckscript.

ModProg avatar ModProg commented on July 24, 2024

and i think there is no way that every source file needs to be checked against every target file.

That is probably true, but I'd rather take the cost of comparing every file with every file than actually figuring out the exact mapping, that's also why sagiegurari/cargo-make#611 (comment) would be sufficient for my use.

Probably a better way to do it would be iterating over both folders and just take the highest timestamp, tho.

from duckscript.

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.