@bscotch/stitch
Version:
Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.
41 lines • 1.13 kB
JavaScript
import paths from '../../utility/paths.js';
export class Gms2Folder {
#data;
constructor(folder) {
this.#data = { ...folder };
}
/** The path as seen by a user in the IDE. */
get path() {
// e.g. folders/sample_resources/group with spaces and !$@#%()*&.yy
return this.#data.folderPath.replace(/^folders\//, '').replace(/.yy$/, '');
}
get name() {
return this.#data.name;
}
toJSON() {
return { ...this.#data };
}
/**
* Given a path as seen in the IDE,
* get the 'folderPath' field value used in the .yyp and .yy files
*/
static folderPathFromPath(path) {
return `folders/${path}.yy`;
}
/**
* Given a path as seen in the IDE,
* get the 'name' field value used in the .yyp and .yy files
*/
static nameFromPath(path) {
return paths.parse(path).name;
}
static get defaultDataValues() {
return {
tags: [],
order: 1,
resourceType: 'GMFolder',
resourceVersion: '1.0',
};
}
}
//# sourceMappingURL=Gms2Folder.js.map