MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / apply_format_extension

Function apply_format_extension

src/host/ui/export_dialog.cpp:81–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void apply_format_extension(ExportDialogState& st) {
82 if (st.user_edited_path) {
83 return;
84 }
85
86 std::string path(st.path_buf.data());
87 const std::string_view target = extension_for(st.format);
88
89 if (ends_with(path, kPngExt) || ends_with(path, kOctExt)) {
90 const std::string_view current =
91 ends_with(path, kPngExt) ? kPngExt : kOctExt;
92 if (current != target) {
93 path.resize(path.size() - current.size());
94 path += target;
95 }
96 } else {
97 path += target;
98 }
99
100 set_path_buf(st.path_buf, path);
101}
102
103void open_export_dialog(ExportDialogState& st,
104 const std::string& buffer_name,

Callers 2

draw_export_dialogFunction · 0.85
TESTFunction · 0.85

Calls 5

extension_forFunction · 0.85
ends_withFunction · 0.85
set_path_bufFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68