mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-28 21:31:03 +00:00
Fix: using node:fs instead of fs
This commit is contained in:
@@ -59,7 +59,7 @@ const removeGameFromLibrary = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (assetPathsToDelete.length > 0) {
|
if (assetPathsToDelete.length > 0) {
|
||||||
const fs = await import("fs");
|
const fs = await import("node:fs");
|
||||||
for (const assetPath of assetPathsToDelete) {
|
for (const assetPath of assetPathsToDelete) {
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(assetPath)) {
|
if (fs.existsSync(assetPath)) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const updateCustomGame = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oldAssetPaths.length > 0) {
|
if (oldAssetPaths.length > 0) {
|
||||||
const fs = await import("fs");
|
const fs = await import("node:fs");
|
||||||
for (const assetPath of oldAssetPaths) {
|
for (const assetPath of oldAssetPaths) {
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(assetPath)) {
|
if (fs.existsSync(assetPath)) {
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ const updateGameCustomAssets = async (
|
|||||||
if (existingAssets) {
|
if (existingAssets) {
|
||||||
const updatedAssets = {
|
const updatedAssets = {
|
||||||
...existingAssets,
|
...existingAssets,
|
||||||
title,
|
title,
|
||||||
};
|
};
|
||||||
|
|
||||||
await gamesShopAssetsSublevel.put(gameKey, updatedAssets);
|
await gamesShopAssetsSublevel.put(gameKey, updatedAssets);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldAssetPaths.length > 0) {
|
if (oldAssetPaths.length > 0) {
|
||||||
const fs = await import("fs");
|
const fs = await import("node:fs");
|
||||||
for (const assetPath of oldAssetPaths) {
|
for (const assetPath of oldAssetPaths) {
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(assetPath)) {
|
if (fs.existsSync(assetPath)) {
|
||||||
|
|||||||
@@ -400,19 +400,22 @@ export function EditGameModal({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to reset form to initial state
|
// Helper function to reset form to initial state
|
||||||
const resetFormToInitialState = useCallback((game: LibraryGame | Game) => {
|
const resetFormToInitialState = useCallback(
|
||||||
setGameName(game.title || "");
|
(game: LibraryGame | Game) => {
|
||||||
|
setGameName(game.title || "");
|
||||||
|
|
||||||
if (isCustomGame(game)) {
|
if (isCustomGame(game)) {
|
||||||
setCustomGameAssets(game);
|
setCustomGameAssets(game);
|
||||||
// Clear default URLs for custom games
|
// Clear default URLs for custom games
|
||||||
setDefaultIconUrl(null);
|
setDefaultIconUrl(null);
|
||||||
setDefaultLogoUrl(null);
|
setDefaultLogoUrl(null);
|
||||||
setDefaultHeroUrl(null);
|
setDefaultHeroUrl(null);
|
||||||
} else {
|
} else {
|
||||||
setNonCustomGameAssets(game as LibraryGame);
|
setNonCustomGameAssets(game as LibraryGame);
|
||||||
}
|
}
|
||||||
}, [setCustomGameAssets, setNonCustomGameAssets]);
|
},
|
||||||
|
[setCustomGameAssets, setNonCustomGameAssets]
|
||||||
|
);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
if (!isUpdating && game) {
|
if (!isUpdating && game) {
|
||||||
|
|||||||
Reference in New Issue
Block a user