squishjs 1.0.1 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/Asset.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const { getAppDataPath } = require('./utils');
2
3
 
3
4
  const HG_ASSET_PATH = path.join(getAppDataPath(), 'asset-cache');
4
5
 
package/src/utils.js ADDED
@@ -0,0 +1,27 @@
1
+ const path = require('path');
2
+
3
+ const getAppDataPath = () => {
4
+ if (!process) {
5
+ return "";
6
+ }
7
+
8
+ switch (process.platform) {
9
+ case "darwin": {
10
+ return path.join(process.env.HOME, "Library", "Application Support", "homegames");
11
+ }
12
+ case "win32": {
13
+ return path.join(process.env.APPDATA, "homegames");
14
+ }
15
+ case "linux": {
16
+ return path.join(process.env.HOME, ".homegames");
17
+ }
18
+ default: {
19
+ console.log("Unsupported platform!");
20
+ process.exit(1);
21
+ }
22
+ }
23
+ }
24
+
25
+ module.exports = {
26
+ getAppDataPath
27
+ }