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
4 changes: 4 additions & 0 deletions creator_project/packages/creator-luacpp-support/core/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class Utils {
return (path.substr(0, path.lastIndexOf(".")) + ext);
}

static replaceFileName(path, fileName) {
return (path.substr(0, path.lastIndexOf("/")) + "/" + fileName);
}

static recordBuild() {
Utils.initAnalytics(function(analytics){
analytics.CAEvent.onEvent({ eventName: 'build' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,16 @@ let get_font_path_by_uuid = function(uuid) {

if (type === 'cc.BitmapFont') {
// png path
let fnt_name = contents_json._name + '.fnt';
let png_uuid = contents_json.spriteFrame.__uuid__;
let json_png = JSON.parse(fs.readFileSync(uuidinfos[png_uuid]));
let png_path_info = get_relative_full_path_by_uuid(json_png.content.texture);
state._uuid[png_uuid] = png_path_info;

// fnt path
state._uuid[uuid] = {
fullpath: Utils.replaceExt(png_path_info.fullpath, '.fnt'),
relative_path: Utils.replaceExt(png_path_info.relative_path, '.fnt')
fullpath: Utils.replaceFileName(png_path_info.fullpath, fnt_name),
relative_path: Utils.replaceFileName(png_path_info.relative_path, fnt_name)
}

return state._uuid[uuid].relative_path;
Expand Down