Kelsidavis-WoWee/tools/editor/cli_rename_magic.hpp
Kelsi 4b928274b8 feat(editor): add --rename-by-magic extension recovery flag
Reads the 4-byte magic of a file, looks it up in the shared
format table, and renames the file to use the correct .w*
extension. Useful when files have lost their extensions
(downloaded as 'data.bin', extracted from a tarball with
mangled metadata, or copied via a tool that strips suffixes).

Safe by default — refuses to overwrite an existing target;
pass --force to allow overwrite. --dry-run prints the planned
move without touching the filesystem. Files that already have
the correct extension are a no-op. Unrecognized magic exits
1 with the bytes printed for diagnostic context.

Reuses cli_format_table.cpp so any future format addition is
picked up automatically.
2026-05-09 19:29:18 -07:00

11 lines
198 B
C++

#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleRenameMagic(int& i, int argc, char** argv, int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee