mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	Fixed animation.scss, electron index
In electron fname is changed instead of a whole if else statement Animation.scss is back to normal
This commit is contained in:
		
							parent
							
								
									8298866424
								
							
						
					
					
						commit
						6a7e8524bb
					
				| @ -17,10 +17,11 @@ const roamingFolder = | |||||||
| let storePath = path.join(roamingFolder, "shapez.io", "saves"); | let storePath = path.join(roamingFolder, "shapez.io", "saves"); | ||||||
| let modsPath = path.join(roamingFolder, "shapez.io", "mods"); | let modsPath = path.join(roamingFolder, "shapez.io", "mods"); | ||||||
| 
 | 
 | ||||||
| if (!fs.existsSync(storePath)) { | if (!fs.existsSync(storePath)) | ||||||
|     // No try-catch by design
 | // No try-catch by design
 | ||||||
|     fs.mkdirSync(storePath, { recursive: true }); |     fs.mkdirSync(storePath, { recursive: true }); | ||||||
| } | 
 | ||||||
|  | if (!fs.existsSync(modsPath)) fs.mkdirSync(modsPath); | ||||||
| 
 | 
 | ||||||
| /** @type {BrowserWindow} */ | /** @type {BrowserWindow} */ | ||||||
| let win = null; | let win = null; | ||||||
| @ -154,147 +155,82 @@ ipcMain.on("exit-app", (event, flag) => { | |||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| function performFsJob(job) { | function performFsJob(job) { | ||||||
|     if (job.mods) { |     let fname = path.join(storePath, job.filename); | ||||||
|         if (!fs.existsSync(modsPath)) fs.mkdirSync(modsPath); |     if (job.mods) fname = path.join(modsPath, job.filename); | ||||||
|         switch (job.type) { | 
 | ||||||
|             case "get": |     switch (job.type) { | ||||||
|                 { |         case "readDir": | ||||||
|                     let contents = ""; |             { | ||||||
|                     try { |                 let contents = ""; | ||||||
|                         contents = fs.readdirSync(modsPath, { encoding: "utf8" }); |                 try { | ||||||
|                     } catch (ex) { |                     contents = fs.readdirSync(fname, { encoding: "utf8" }); | ||||||
|                         return { |                 } catch (ex) { | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
|                     return { |                     return { | ||||||
|                         success: true, |                         error: ex, | ||||||
|                         data: contents, |  | ||||||
|                     }; |                     }; | ||||||
|                 } |                 } | ||||||
|             case "read": |                 return { | ||||||
|                 { |                     success: true, | ||||||
|                     const fname = path.join(modsPath, job.filename); |                     data: contents, | ||||||
|                     if (!fs.existsSync(fname)) { |                 }; | ||||||
|                         return { |             } | ||||||
|                             // Special FILE_NOT_FOUND error code
 |         case "read": | ||||||
|                             error: "file_not_found", |             { | ||||||
|                         }; |                 if (!fs.existsSync(fname)) { | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     let contents = ""; |  | ||||||
|                     try { |  | ||||||
|                         contents = fs.readFileSync(fname, { encoding: "utf8" }); |  | ||||||
|                     } catch (ex) { |  | ||||||
|                         return { |  | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     return { |                     return { | ||||||
|                         success: true, |                         // Special FILE_NOT_FOUND error code
 | ||||||
|                         data: contents, |                         error: "file_not_found", | ||||||
|                     }; |  | ||||||
|                 } |  | ||||||
|             case "write": |  | ||||||
|                 { |  | ||||||
|                     const fname = path.join(modsPath, job.filename); |  | ||||||
|                     try { |  | ||||||
|                         fs.writeFileSync(fname, job.contents); |  | ||||||
|                     } catch (ex) { |  | ||||||
|                         return { |  | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     return { |  | ||||||
|                         success: true, |  | ||||||
|                         data: job.contents, |  | ||||||
|                     }; |                     }; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|             case "delete": |                 let contents = ""; | ||||||
|                 { |                 try { | ||||||
|                     const fname = path.join(modsPath, job.filename); |                     contents = fs.readFileSync(fname, { encoding: "utf8" }); | ||||||
|                     try { |                 } catch (ex) { | ||||||
|                         fs.unlinkSync(fname); |  | ||||||
|                     } catch (ex) { |  | ||||||
|                         return { |  | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     return { |                     return { | ||||||
|                         success: true, |                         error: ex, | ||||||
|                         data: null, |  | ||||||
|                     }; |                     }; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|             default: |                 return { | ||||||
|                 throw new Error("Unkown fs job: " + job.type); |                     success: true, | ||||||
|         } |                     data: contents, | ||||||
|     } else { |                 }; | ||||||
|         const fname = path.join(storePath, job.filename); |             } | ||||||
| 
 |         case "write": | ||||||
|         switch (job.type) { |             { | ||||||
|             case "read": |                 try { | ||||||
|                 { |                     fs.writeFileSync(fname, job.contents); | ||||||
|                     if (!fs.existsSync(fname)) { |                 } catch (ex) { | ||||||
|                         return { |  | ||||||
|                             // Special FILE_NOT_FOUND error code
 |  | ||||||
|                             error: "file_not_found", |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     let contents = ""; |  | ||||||
|                     try { |  | ||||||
|                         contents = fs.readFileSync(fname, { encoding: "utf8" }); |  | ||||||
|                     } catch (ex) { |  | ||||||
|                         return { |  | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     return { |                     return { | ||||||
|                         success: true, |                         error: ex, | ||||||
|                         data: contents, |  | ||||||
|                     }; |  | ||||||
|                 } |  | ||||||
|             case "write": |  | ||||||
|                 { |  | ||||||
|                     try { |  | ||||||
|                         fs.writeFileSync(fname, job.contents); |  | ||||||
|                     } catch (ex) { |  | ||||||
|                         return { |  | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     return { |  | ||||||
|                         success: true, |  | ||||||
|                         data: job.contents, |  | ||||||
|                     }; |                     }; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|             case "delete": |                 return { | ||||||
|                 { |                     success: true, | ||||||
|                     try { |                     data: job.contents, | ||||||
|                         fs.unlinkSync(fname); |                 }; | ||||||
|                     } catch (ex) { |             } | ||||||
|                         return { |  | ||||||
|                             error: ex, |  | ||||||
|                         }; |  | ||||||
|                     } |  | ||||||
| 
 | 
 | ||||||
|  |         case "delete": | ||||||
|  |             { | ||||||
|  |                 try { | ||||||
|  |                     fs.unlinkSync(fname); | ||||||
|  |                 } catch (ex) { | ||||||
|                     return { |                     return { | ||||||
|                         success: true, |                         error: ex, | ||||||
|                         data: null, |  | ||||||
|                     }; |                     }; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|             default: |                 return { | ||||||
|                 throw new Error("Unkown fs job: " + job.type); |                     success: true, | ||||||
|         } |                     data: null, | ||||||
|  |                 }; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         default: | ||||||
|  |             throw new Error("Unkown fs job: " + job.type); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,13 +1,16 @@ | |||||||
| @include MakeAnimationWrappedEvenOdd(0.2s ease-in-out, "changeAnim") { | @each $animName in ("changeAnimEven", "changeAnimOdd") { | ||||||
|     0% { |     @keyframes #{$animName} { | ||||||
|         transform: scale(1, 1); |         0% { | ||||||
|  |             transform: scale(1, 1); | ||||||
|  |         } | ||||||
|  |         50% { | ||||||
|  |             transform: scale(1.03, 1.03); | ||||||
|  |         } | ||||||
|  |         100% { | ||||||
|  |             transform: scale(1, 1); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 |     .#{$animName} { | ||||||
|     50% { |         animation: $animName 0.2s ease-in-out; | ||||||
|         transform: scale(1.03, 1.03); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     100% { |  | ||||||
|         transform: scale(1, 1); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -137,7 +137,8 @@ window.onload = async () => { | |||||||
|     if (G_IS_STANDALONE) { |     if (G_IS_STANDALONE) { | ||||||
|         modFolderContents = getIPCRenderer().sendSync("fs-sync-job", { |         modFolderContents = getIPCRenderer().sendSync("fs-sync-job", { | ||||||
|             mods: true, |             mods: true, | ||||||
|             type: "get", |             type: "readDir", | ||||||
|  |             filename: "", | ||||||
|         }).data; |         }).data; | ||||||
|         if (modFolderContents.includes("modpack.json")) { |         if (modFolderContents.includes("modpack.json")) { | ||||||
|             instance = getIPCRenderer().sendSync("fs-sync-job", { |             instance = getIPCRenderer().sendSync("fs-sync-job", { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user