Skip to content

Commit

Permalink
force using \n for export file
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Oct 1, 2024
1 parent 25cf472 commit 672fdb2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/handlers/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function editMap(mapName: string, map: any) {

// const map = fs.readJsonSync(path);
fixTiledMapPaths(map);
fs.writeJsonSync(path, map);
fs.writeJSONSync(path, map);

childProcess.exec(`${baseUrl}/resources/Tiled/tiled.exe "${path}"`);
}
Expand Down
1 change: 1 addition & 0 deletions app/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './constants';
export * from './dependencies';
export * from './json';
export * from './modtest';
5 changes: 5 additions & 0 deletions app/helpers/json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as fs from 'fs-extra';

export function saveSpecificJSON(path: string, json: any) {
fs.writeJSONSync(path, json, { spaces: 2, EOL: '\n' });
}
2 changes: 1 addition & 1 deletion app/helpers/modtest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function testMod(sendToUI: SendToUI, modData: any) {
fs.ensureDirSync(`${baseUrl}/resources/rair/content/mods`);
fs.rmdirSync(`${baseUrl}/resources/rair/content/mods`, { recursive: true });
fs.ensureDirSync(`${baseUrl}/resources/rair/content/mods`);
fs.writeJsonSync(`${baseUrl}/resources/rair/content/mods/mod.rairmod`, mod);
fs.writeJSONSync(`${baseUrl}/resources/rair/content/mods/mod.rairmod`, mod);
sendToUI('notify', { type: 'info', text: 'Copied mod file!' });

// write .env
Expand Down
2 changes: 1 addition & 1 deletion app/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export function setupIPC(sendToUI: SendToUI) {
try {
const fullMod = modData;

fs.writeJSONSync(res, fullMod, { spaces: 2 });
helpers.saveSpecificJSON(res, fullMod);
sendToUI('notify', { type: 'info', text: `Saved ${res}!` });
sendToUI('updatesetting', { setting: 'autosaveFilePath', value: res });
} catch {
Expand Down

0 comments on commit 672fdb2

Please sign in to comment.