Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Asset Sync variant to sync only assets used by a world #10

Open
rikmarais opened this issue Oct 2, 2023 · 1 comment

Comments

@rikmarais
Copy link
Contributor

rikmarais commented Oct 2, 2023

Either as a separate tool or as an option to the Asset Sync, allow the tool to "find all image paths used by this world and compendiums" and then sync only those files.

This is an alternative to the full Asset Sync and prevents long sync times for large amounts of assets when the intent is to sync only the assets required by a specific world.

--- Possible alternative ---
Before Asset Sync begins, allow the user to set filters to exclude or include specific path prefixes starting from the root of the Assets Library.

This will allow the users to exclude syncing assets for specific premium packages that would be downloaded by Foundry at install time anyway.

It would also allow users to backup specific directories from their assets library while avoiding other directories that they already have backed up, which could otherwise make the sync take substantially longer.

WIP design

function filterFiles(files, include = [], exclude = []) {
    return files.filter(file => {
        const shouldInclude = include.some(prefix => file.startsWith(prefix));
        const shouldExclude = exclude.some(prefix => file.startsWith(prefix));
        return (include.length === 0 || shouldInclude) && !shouldExclude;
    });
}

// Usage:
const allFiles = ['path/to/file1', 'path/to/file2', 'path/to/file3'];
const includePrefixes = ['path/to'];
const excludePrefixes = ['path/to/file2'];

const filteredFiles = filterFiles(allFiles, includePrefixes, excludePrefixes);
console.log(filteredFiles);  // Output: ['path/to/file1', 'path/to/file3']
@rikmarais rikmarais changed the title [Feature request] Asset Sync includes/excludes prefixes [Feature request] Asset Sync variant to sync only assets used by a world Oct 2, 2023
@rikmarais
Copy link
Contributor Author

#13 allows for partial asset sync but does not restrict to only assets of the specific world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant