-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I am currently trying to debug this issue:
fossasia/open-event-frontend#7971
I have a plugin that looks basically like this:
class CreateEmberL10nFastBootAssetMap extends Plugin {
constructor(
inputNode
) {
super([inputNode], {});
}
build() {
// We only support passing in one input path (for simplicity)
this.inputPath = this.inputPaths[0];
this.parseNode(this.inputPath);
this.createFastBootAssetMapModule();
}
parseNode(inputPath) {
let stat = this.input.statSync(inputPath);
if (stat.isFile()) {
this.parseFile(inputPath);
} else if (stat.isDirectory()) {
this.parseDirectory(inputPath);
}
}
parseDirectory(inputPath) {
let outputPath = this._getOutputPath(inputPath);
if (!this.output.existsSync(outputPath)) {
this.output.mkdirSync(outputPath);
}
let files = this.input.readdirSync(inputPath);
files.forEach((file) => this.parseNode(path.join(inputPath, file)));
}
parseFile(inputPath) {
let content = this.input.readFileSync(inputPath);
let outputPath = this._getOutputPath(inputPath);
// logic goes here
}
_getOutputPath(inputPath) {
return path.relative(this.inputPath, inputPath);
}
}However, it seems that let inputPath = this.inputPaths[0]; is an absolute path to a temp directory here, e.g.:
/tmp/broccoli-3137903S9AmcZtiodI/out-0999-append_ember_auto_import_analyzer/
And this.input.readdirSync or this.input.readFileSync will convert that into e.g.
/tmp/broccoli-3137903S9AmcZtiodI/out-0999-append_ember_auto_import_analyzer//tmp/broccoli-3137903S9AmcZtiodI/out-0999-append_ember_auto_import_analyzer
Which obviously does not exist. To be honest I am not quite sure where that comes from exactly, but somewhere there seems to be a missing handling for absolute paths, I guess?
progmatic-99, mariobehling, pavnesh-c and codedsun
Metadata
Metadata
Assignees
Labels
No labels