diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-15 11:40:19 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-15 11:40:19 +0200 |
commit | 4e77740facb23e1c392f180381ccb5446d445724 (patch) | |
tree | d629c4d2960546dab2ed759d756674533baac536 /anim-crop-tool | |
parent | a99c6ebd1c24e3f645e2c07591cfcfa97a162a6b (diff) |
a
Diffstat (limited to 'anim-crop-tool')
-rw-r--r-- | anim-crop-tool/main.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/anim-crop-tool/main.cpp b/anim-crop-tool/main.cpp index b268321e..5caa9fe4 100644 --- a/anim-crop-tool/main.cpp +++ b/anim-crop-tool/main.cpp @@ -250,9 +250,15 @@ int main(int argc, char** argv) if (!anim_ok) return EX_DATAERR; - if (!check_atlas_name(anim_info.name)) + if (!check_atlas_name(anim_info.object_name)) { - Error{} << "error: atlas name" << anim_info.name << "contains invalid characters"; + Error{} << "error: atlas object name" << anim_info.object_name << "is invalid"; + return EX_DATAERR; + } + + if (!check_atlas_name(anim_info.anim_name)) + { + Error{} << "error: atlas animation name" << anim_info.object_name << "contains invalid characters"; return EX_DATAERR; } @@ -281,12 +287,14 @@ int main(int argc, char** argv) return EX_CANTCREAT; } - if (auto pathname = opts.output_dir/(anim_info.name + ".png"); !atlas.dump(pathname)) { + const std::string base_name = anim_info.object_name + "_" + anim_info.anim_name; + + if (auto pathname = opts.output_dir/(base_name + ".png"); !atlas.dump(pathname)) { Error{} << "error: failed writing image to" << pathname << ":" << std::strerror(errno); // NOLINT(concurrency-mt-unsafe) return EX_CANTCREAT; } - if (!json_helper::to_json<anim>(anim_info, opts.output_dir/(anim_info.name + ".json"))) + if (!json_helper::to_json<anim>(anim_info, opts.output_dir/(base_name + ".json"))) return EX_CANTCREAT; return 0; |