homegames-common 1.0.0 → 1.0.2

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 +8 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -724,15 +724,20 @@ const log = {
724
724
  }
725
725
 
726
726
  const getAppDataPath = () => {
727
+ if (!process) {
728
+ // this shouldnt be called if running in browser
729
+ return '';
730
+ }
731
+
727
732
  switch (process.platform) {
728
733
  case "darwin": {
729
- return path.join(process.env.HOME, "Library", "Application Support", "homegames");
734
+ return process.env.HOME ? path.join(process.env.HOME, "Library", "Application Support", "homegames") : __dirname;
730
735
  }
731
736
  case "win32": {
732
- return path.join(process.env.APPDATA, "homegames");
737
+ return process.env.APPDATA ? path.join(process.env.APPDATA, "homegames") : __dirname;
733
738
  }
734
739
  case "linux": {
735
- return path.join(process.env.HOME, ".homegames");
740
+ return process.env.HOME ? path.join(process.env.HOME, ".homegames") : __dirname;
736
741
  }
737
742
  default: {
738
743
  console.log("Unsupported platform!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homegames-common",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Homegames common tools",
5
5
  "main": "index.js",
6
6
  "scripts": {