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

.asar files are treat like folders #7

Open
rasq opened this issue Mar 7, 2018 · 5 comments
Open

.asar files are treat like folders #7

rasq opened this issue Mar 7, 2018 · 5 comments

Comments

@rasq
Copy link

rasq commented Mar 7, 2018

OS: Windows 10.

Unfortunetly klaw-sync treat .asar folders like foders and list's all files that are inside.

this is very problematic, because thouse files are not accesible, example:
electron.asar\browser\api\app.js
electron.asar\browser\api\auto-updater\auto-updater-native.js

@manidlou
Copy link
Owner

manidlou commented Mar 7, 2018

@rasq according to electron docs, node APIs treat asar archives as directories. What is the exact problem that you are facing?

@rasq
Copy link
Author

rasq commented Mar 8, 2018

It will be good to have option to set archives as files for klaw.
Why?
Because sometimes someone will use a files/directories list from klaw and he/she will might to use it for some reason, maybe to create list for software that will check each file, on for archive tool, or maybe to create MSI package. On this cases files from archive are not accesible but they are listed, and error will occure.
I'am having some simillar problem, im generating xml for WixToolset using electron and klaw. And .asar archive are problems, (i need only have file path to .asar, not path to asar and files inside).

@Geelik
Copy link
Contributor

Geelik commented Sep 13, 2018

Hey, late response but now you can filter out directories when traversing. You can look at this test to see how you can do it.

@markmorris
Copy link

markmorris commented Oct 15, 2018

Im facing this exact problem right now. Treating .asar as directory is a killer when trying to create an MSI package using wix. Would be nice to have a clear example of how to treat them like files.

Current Code from electron-wix-msi (https://github.com/felixrieseberg/electron-wix-msi)

function getDirectoryStructure(root) {
return new Promise((resolve, reject) => {
if (!fs.existsSync(root)) {
return reject(new Error(App directory ${root} does not exist));
}
const files = [];
const directories = [];
klaw(root, { })
.on('data', (item) => {
if (item.stats.isFile()) {
files.push(item.path);
}
else if (item.stats.isDirectory() && item.path !== root) {
directories.push(item.path);
}
})
.on('end', () => resolve({ files, directories }));
});
}

@manidlou
Copy link
Owner

@markmorris your code uses klaw and not klaw-sync. I'd recommend to open an issue there!

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

4 participants