squishjs 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils.js +7 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/utils.js CHANGED
@@ -1,15 +1,19 @@
1
1
  const path = require('path');
2
2
 
3
3
  const getAppDataPath = () => {
4
+ if (!process) {
5
+ return "";
6
+ }
7
+
4
8
  switch (process.platform) {
5
9
  case "darwin": {
6
- return path.join(process.env.HOME, "Library", "Application Support", "Your app name");
10
+ return path.join(process.env.HOME, "Library", "Application Support", "homegames");
7
11
  }
8
12
  case "win32": {
9
- return path.join(process.env.APPDATA, "Your app name");
13
+ return path.join(process.env.APPDATA, "homegames");
10
14
  }
11
15
  case "linux": {
12
- return path.join(process.env.HOME, ".Your app name");
16
+ return path.join(process.env.HOME, ".homegames");
13
17
  }
14
18
  default: {
15
19
  console.log("Unsupported platform!");
@@ -18,29 +22,6 @@ const getAppDataPath = () => {
18
22
  }
19
23
  }
20
24
 
21
-
22
- function saveAppData(content) {
23
- const appDatatDirPath = getAppDataPath();
24
-
25
- // Create appDataDir if not exist
26
- if (!fs.existsSync(appDatatDirPath)) {
27
- fs.mkdirSync(appDatatDirPath);
28
- }
29
-
30
- const appDataFilePath = path.join(appDatatDirPath, 'appData.json');
31
- content = JSON.stringify(content);
32
-
33
- fs.writeFile(appDataFilePath, content, (err) => {
34
- if (err) {
35
- console.log("There was a problem saving data!");
36
- // console.log(err);
37
- } else {
38
- console.log("Data saved correctly!");
39
- loadAppData();
40
- }
41
- });
42
- };
43
-
44
25
  module.exports = {
45
26
  getAppDataPath
46
27
  }