Skip to content

Commit

Permalink
Merge pull request #386 from permaweb/jfrain99/get-blueprints-dir
Browse files Browse the repository at this point in the history
fix(aos): get blueprints now uses dir
  • Loading branch information
twilson63 authored Nov 14, 2024
2 parents 945b2f3 + b6b7752 commit dcc6d47
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/services/blueprints.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ if (os.platform() === 'win32') {

export function blueprints(dir) {
try {
if (dir === true) {
dir = __dirname + "../../blueprints"
}
let prints = fs.readdirSync(path.resolve(dir))
const blueprintsDir = __dirname + "../../blueprints"
const outputDir = process.cwd() + '/' + (dir === true ? '' : dir)

let prints = fs.readdirSync(path.resolve(blueprintsDir))
prints.map(n => {
return [n, fs.readFileSync(path.resolve(dir + '/' + n), 'utf-8')]
return [n, fs.readFileSync(path.resolve(blueprintsDir + '/' + n), 'utf-8')]
}).map(([n, lua]) => {
fs.writeFileSync(path.resolve(process.cwd() + '/' + n), lua)
fs.writeFileSync(path.resolve(outputDir + '/' + n), lua)
})
} catch (e) {
console.error(chalk.red('BLUEPRINT ERROR: Having trouble finding directory or reading files!'))
Expand Down

0 comments on commit dcc6d47

Please sign in to comment.