homegames-common 1.0.7 → 1.0.9

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/index.js +13 -4
  2. package/package.json +1 -2
package/index.js CHANGED
@@ -4,7 +4,6 @@ const WebSocket = require('ws');
4
4
  const http = require('http');
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
- const AWS = require('aws-sdk');
8
7
  const unzipper = require('unzipper');
9
8
  const crypto = require('crypto');
10
9
  const { Readable } = require('stream');
@@ -748,21 +747,31 @@ const getAppDataPath = () => {
748
747
  return '';
749
748
  }
750
749
 
750
+ let _path;
751
751
  switch (process.platform) {
752
752
  case "darwin": {
753
- return process.env.HOME ? path.join(process.env.HOME, "Library", "Application Support", "homegames") : __dirname;
753
+ _path = process.env.HOME ? path.join(process.env.HOME, "Library", "Application Support", "homegames") : __dirname;
754
+ break;
754
755
  }
755
756
  case "win32": {
756
- return process.env.APPDATA ? path.join(process.env.APPDATA, "homegames") : __dirname;
757
+ _path = process.env.APPDATA ? path.join(process.env.APPDATA, "homegames") : __dirname;
758
+ break;
757
759
  }
758
760
  case "linux": {
759
- return process.env.HOME ? path.join(process.env.HOME, ".homegames") : __dirname;
761
+ _path = process.env.HOME ? path.join(process.env.HOME, ".homegames") : __dirname;
762
+ break;
760
763
  }
761
764
  default: {
762
765
  console.log("Unsupported platform!");
763
766
  process.exit(1);
764
767
  }
765
768
  }
769
+
770
+ if (!fs.existsSync(_path)) {
771
+ fs.mkdirSync(_path);
772
+ }
773
+
774
+ return _path;
766
775
  }
767
776
 
768
777
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homegames-common",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Homegames common tools",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,7 +17,6 @@
17
17
  },
18
18
  "homepage": "https://github.com/homegamesio/homegames-common#readme",
19
19
  "dependencies": {
20
- "aws-sdk": "^2.1151.0",
21
20
  "unzipper": "^0.10.11",
22
21
  "ws": "^7.5.4"
23
22
  }