Skip to content

Commit

Permalink
Fixed truncate but its still broken :'(
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus committed Aug 25, 2024
1 parent 6434ffb commit 67f980a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions util/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,15 @@ if (!process.argv.includes('--skip-collect') && only.includes('collect')) {

const is_local = existsSync('/home/deck/homebrew');

if (!is_local) {
Logger.Info('Not running on steamdeck');
}

if (is_local && (!process.argv.includes('--skip-copy') && only.includes('copy'))) {
Logger.Log('Copying build folder to local plugin directory');
execSync(`sudo rm -rf /home/deck/homebrew/plugins/${PluginName}`);
execSync(`sudo cp -r build/ /home/deck/homebrew/plugins/${PluginName}`);
execSync(`sudo chmod 555 /home/deck/homebrew/plugins/${PluginName}`);
} else {
if (!process.argv.includes('--skip-copy') || only.includes('copy'))
if (!is_local) {
Logger.Info('Not running on steamdeck');
} else if (!process.argv.includes('--skip-copy') && only.includes('copy'))
Logger.Log('Skipping copying build folder to local plugin directory');
}

Expand Down
4 changes: 2 additions & 2 deletions util/versioning.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync, writeFileSync, openSync, fstatSync, utimesSync, closeSync, truncateSync } from "fs";
import { readFileSync, writeFileSync, openSync, fstatSync, utimesSync, closeSync, ftruncateSync } from "fs";
import { dirname, resolve } from "path";
import { fileURLToPath } from "url";

Expand All @@ -17,7 +17,7 @@ function WriteVersionToPackage(file, version) {
var value = readFileSync(fd, { encoding: "utf-8", flag: "r" });
const pkg = JSON.parse(value);
pkg.version = version;
truncateSync(fd, 0);
ftruncateSync(fd);
writeFileSync(fd, JSON.stringify(pkg, null, " "));
} finally {
closeSync(fd);
Expand Down

0 comments on commit 67f980a

Please sign in to comment.