Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions polymod/Polymod.hx
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,11 @@ class ModMetadata
*/
public var modPath:String;

/**
* The directory name of the mod.
*/
public var dirName:String;

/**
* `metadata` provides an optional list of keys.
* These can provide additional information about the mod, specific to your application.
Expand Down Expand Up @@ -1021,6 +1026,7 @@ class ModMetadata
}

var m = new ModMetadata();
m.id = JsonHelp.str(json, 'id');
m.title = JsonHelp.str(json, 'title');
m.description = JsonHelp.str(json, 'description');
m._author = JsonHelp.str(json, 'author');
Expand Down
9 changes: 5 additions & 4 deletions polymod/fs/MemoryFileSystem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ class MemoryFileSystem implements PolymodFileSystem.IFileSystem
return result;
}

public function getMetadata(modId:String)
public function getMetadata(dirName:String)
{
var modpath = Util.pathJoin(modRoot, modId);
var modpath = Util.pathJoin(modRoot, dirName);
if (exists(modpath))
{
var meta:ModMetadata = null;
Expand All @@ -209,7 +209,8 @@ class MemoryFileSystem implements PolymodFileSystem.IFileSystem
meta = ModMetadata.fromJsonStr(metaText);
if (meta == null) return null;

meta.id = modId;
meta.id = meta.id == '' ? dirName : meta.id;
meta.dirName = dirName;
meta.modPath = modpath;
}

Expand All @@ -227,7 +228,7 @@ class MemoryFileSystem implements PolymodFileSystem.IFileSystem
}
else
{
Polymod.error(MISSING_MOD, 'Could not find mod directory: $modpath');
Polymod.error(MISSING_MOD, 'Could not find mod directory: $dirName');
}
return null;
}
Expand Down
9 changes: 5 additions & 4 deletions polymod/fs/SysFileSystem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class SysFileSystem implements IFileSystem
return result;
}

public function getMetadata(modId:String)
public function getMetadata(dirName:String)
{
var modPath = Util.pathJoin(modRoot, modId);
var modPath = Util.pathJoin(modRoot, dirName);
if (exists(modPath))
{
var meta:ModMetadata = null;
Expand All @@ -127,7 +127,8 @@ class SysFileSystem implements IFileSystem

if (meta == null) return null;

meta.id = modId;
meta.id = meta.id == '' ? dirName : meta.id;
meta.dirName = dirName;
meta.modPath = modPath;

if (!exists(iconFile))
Expand All @@ -144,7 +145,7 @@ class SysFileSystem implements IFileSystem
}
else
{
Polymod.error(MISSING_MOD, 'Could not find mod directory: $modId');
Polymod.error(MISSING_MOD, 'Could not find mod directory: $dirName');
}
return null;
}
Expand Down