mirror of
https://github.com/genxium/DelayNoMore
synced 2025-11-10 08:16:39 +00:00
Initial commit.
This commit is contained in:
39
frontend/packages/i18n-master/utils/package.js
Normal file
39
frontend/packages/i18n-master/utils/package.js
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const Fs = require('fire-fs');
|
||||
const Path = require('path');
|
||||
|
||||
// adapter project path
|
||||
let projectPath = Editor.projectPath;
|
||||
if (!projectPath) {
|
||||
projectPath = Editor.Project.path;
|
||||
}
|
||||
|
||||
let PATH = Path.join(projectPath, './assets/resources/i18n');
|
||||
|
||||
let mount = function () {
|
||||
// 创建目录,保证目录存在
|
||||
Fs.ensureDirSync(PATH);
|
||||
};
|
||||
|
||||
let unmount = function () {
|
||||
// 如果目录为空则删除目录
|
||||
if (!Fs.existsSync(PATH)) {
|
||||
return;
|
||||
}
|
||||
if (Fs.readdirSync(PATH).length === 0) {
|
||||
Fs.unlink(PATH);
|
||||
}
|
||||
};
|
||||
|
||||
let metrics = function () {
|
||||
Editor.Metrics.trackEvent({
|
||||
category: 'Packages',
|
||||
label: 'i18n',
|
||||
action: 'Panel Open'
|
||||
}, null);
|
||||
};
|
||||
|
||||
exports.mount = mount;
|
||||
exports.unmount = unmount;
|
||||
exports.metrics = metrics;
|
||||
Reference in New Issue
Block a user