Skip to content

Commit

Permalink
Fix small CC editor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Llennpie committed Jan 7, 2024
1 parent aef6fbe commit 5cc45a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/saturn/imgui/saturn_imgui_cc_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,11 @@ void OpenModelCCSelector(Model model, std::vector<std::string> list, std::string

// Right-Click Menu
if (ImGui::BeginPopupContextItem()) {
if (label_name_lower != "default" || label_name_lower != "../default") {
ImGui::Text("%s.gs", label_name.c_str());
imgui_bundled_tooltip((model.FolderPath + "/colorcodes/" + label_name + ".gs").c_str());
ImGui::Separator();
ImGui::Text("%s.gs", label_name.c_str());
imgui_bundled_tooltip((model.FolderPath + "/colorcodes/" + label_name + ".gs").c_str());

// Delete GS File
// Delete GS File
if (label_name_lower != "default" && label_name_lower != "../default") {
if (ImGui::Button(ICON_FK_TRASH " Delete File"))
ImGui::OpenPopup("###delete_m_gs_file");
if (ImGui::BeginPopup("###delete_m_gs_file")) {
Expand All @@ -293,7 +292,8 @@ void OpenModelCCSelector(Model model, std::vector<std::string> list, std::string
ImGui::EndPopup();
}
}


ImGui::Separator();
ImGui::TextDisabled("%i color code(s)", list.size());
if (ImGui::Button(ICON_FK_UNDO " Refresh")) {
RefreshColorCodeList();
Expand Down
5 changes: 5 additions & 0 deletions src/saturn/saturn_colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ void SaveGSFile(ColorCode colorCode, std::string filePath) {
}

void DeleteGSFile(std::string filePath) {
// Disallow paths that reach out of bounds
if (filePath.find("/colorcodes/") == std::string::npos ||
filePath.find("../") != std::string::npos)
return;

if (fs::exists(filePath))
fs::remove(filePath);
}
Expand Down

0 comments on commit 5cc45a7

Please sign in to comment.