Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Add .smm file to SMM tracked mod folders
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Apr 20, 2021
1 parent 8490dbf commit 2740fe8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let cachedMods = new Array<Mod>();
let cacheLoaded = false;

const modExtensions = ['.smod'];
const SMM_TRACKED_FILE = '.smm';

function getModFromUPlugin(mod_reference: string, uplugin: UPlugin): Mod {
const mod = {
Expand Down Expand Up @@ -195,6 +196,7 @@ export async function installMod(modReference: string, version: string, modsDir:
const extractPath = path.join(modsDir, modReference);
ensureExists(extractPath);
await zipData.extract(null, extractPath);
fs.writeFileSync(path.join(extractPath, SMM_TRACKED_FILE), '');
} else {
throw new Error('Invalid smlVersion');
}
Expand Down Expand Up @@ -265,6 +267,7 @@ export async function getInstalledMods(modsDir: string | undefined, smlVersion:
fs.readdirSync(modsDir).forEach((dir) => {
if (dir === SMLID) return;
const fullPath = path.join(modsDir, dir);
if (!fs.existsSync(path.join(fullPath, SMM_TRACKED_FILE))) return;
const upluginPath = path.join(fullPath, `${dir}.uplugin`);
if (fs.existsSync(upluginPath)) {
try {
Expand Down

0 comments on commit 2740fe8

Please sign in to comment.