Skip to content

Commit 91a2765

Browse files
committed
removes debug code
1 parent 8832034 commit 91a2765

File tree

4 files changed

+29
-67
lines changed

4 files changed

+29
-67
lines changed

sources/Application/Persistency/PersistencyService.cpp

Lines changed: 16 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
#include "Persistent.h"
1515
#include "System/Console/Trace.h"
1616
#include "System/FileSystem/FileSystem.h"
17-
#include "System/FileSystem/I_File.h"
18-
#include "Adapters/picoTracker/gui/picoRemoteUI.h"
19-
#include "System/Console/nanoprintf.h"
2017

2118
#define PROJECT_STATE_FILE "/.current"
2219

@@ -37,62 +34,30 @@ void PersistencyService::PurgeUnnamedProject() {
3734

3835
void PersistencyService::DeleteProject(const char *projectName) {
3936
auto fs = FileSystem::GetInstance();
40-
char buffer[128];
41-
bool status;
42-
43-
Trace::Log("PERSISTENCYSERVICE", "Deleting project: %s", projectName);
44-
45-
status = fs->chdir(PROJECTS_DIR);
46-
47-
if (!status) {
48-
Trace::Error("PERSISTENCYSERVICE", "Failed to change to projects directory");
49-
return;
50-
}
5137

38+
Trace::Debug("PERSISTENCYSERVICE", "Deleting project: %s", projectName);
39+
40+
fs->chdir(PROJECTS_DIR);
5241
fs->chdir(projectName);
53-
fs->DeleteFile(PROJECT_DATA_FILE);
54-
fs->DeleteFile(AUTO_SAVE_FILENAME);
55-
42+
fs->DeleteFile(PROJECT_DATA_FILE);
43+
fs->DeleteFile(AUTO_SAVE_FILENAME);
44+
5645
fs->chdir(PROJECT_SAMPLES_DIR);
57-
etl::vector<int, MAX_SAMPLES> fileIndexes;
58-
fs->list(&fileIndexes, ".wav", false);
59-
60-
// delete all samples
61-
char filename[128];
62-
for (size_t i = 0; i < fileIndexes.size(); i++) {
63-
fs->getFileName(fileIndexes[i], filename, MAX_PROJECT_SAMPLE_PATH_LENGTH);
64-
fs->DeleteFile(filename);
46+
etl::vector<int, MAX_SAMPLES> fileIndexes;
47+
fs->list(&fileIndexes, ".wav", false);
48+
49+
// delete all samples
50+
char filename[128];
51+
for (size_t i = 0; i < fileIndexes.size(); i++) {
52+
fs->getFileName(fileIndexes[i], filename, MAX_PROJECT_SAMPLE_PATH_LENGTH);
53+
fs->DeleteFile(filename);
6554
};
6655

6756
fs->chdir(".."); // up to project dir
68-
status = fs->DeleteDir(PROJECT_SAMPLES_DIR);
69-
70-
if (status) {
71-
Trace::Log("PERSISTENCYSERVICE", "Successfully deleted the samples directory");
72-
73-
npf_snprintf(buffer, sizeof(buffer), "Successfully deleted the samples directory\n\r");
74-
sendToUSBCDC(buffer, strlen(buffer));
75-
} else {
76-
Trace::Log("PERSISTENCYSERVICE", "Failed to delete the samples directory");
77-
78-
npf_snprintf(buffer, sizeof(buffer), "Failed to delete the samples directory\n\r");
79-
sendToUSBCDC(buffer, strlen(buffer));
80-
}
57+
fs->DeleteDir(PROJECT_SAMPLES_DIR);
8158

8259
fs->chdir(".."); // up to projects dir
83-
status = fs->DeleteDir(projectName);
84-
85-
if (status) {
86-
Trace::Log("PERSISTENCYSERVICE", "Successfully deleted project: %s", projectName);
87-
88-
npf_snprintf(buffer, sizeof(buffer), "Successfully deleted project: %s\n\r", projectName);
89-
sendToUSBCDC(buffer, strlen(buffer));
90-
} else {
91-
Trace::Error("PERSISTENCYSERVICE", "Failed to delete project: %s", projectName);
92-
93-
npf_snprintf(buffer, sizeof(buffer), "Failed deleting project: %s\n\r", projectName);
94-
sendToUSBCDC(buffer, strlen(buffer));
95-
}
60+
fs->DeleteDir(projectName);
9661
}
9762

9863
PersistencyResult

sources/Application/Views/SelectProjectView.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void DeleteProjectCallback(View &v, ModalView &dialog) {
2424
char buffer[MAX_PROJECT_NAME_LENGTH + 1];
2525
((SelectProjectView &)v).getHighlightedProjectName(buffer);
2626
ps->DeleteProject(buffer);
27-
27+
2828
// reload list
2929
((SelectProjectView &)v).setCurrentFolder();
3030
}
@@ -48,23 +48,22 @@ void SelectProjectView::DrawView() {
4848
const char *title = "Load Project";
4949
SetColor(CD_INFO);
5050
DrawString(pos._x + 1, pos._y, title, props);
51-
5251
SetColor(CD_NORMAL);
53-
52+
5453
// Draw projects
5554
int x = 1;
5655
int y = pos._y + 2;
57-
56+
5857
for (size_t i = topIndex_;
59-
i < topIndex_ + LIST_PAGE_SIZE && (i < fileIndexList_.size()); i++) {
60-
if (i == currentIndex_) {
61-
props.invert_ = true;
62-
SetColor(CD_HILITE2);
63-
} else {
64-
SetColor(CD_NORMAL);
65-
props.invert_ = false;
66-
}
67-
58+
i < topIndex_ + LIST_PAGE_SIZE && (i < fileIndexList_.size()); i++) {
59+
if (i == currentIndex_) {
60+
props.invert_ = true;
61+
SetColor(CD_HILITE2);
62+
} else {
63+
SetColor(CD_NORMAL);
64+
props.invert_ = false;
65+
}
66+
6867
char buffer[MAX_PROJECT_NAME_LENGTH + 1];
6968
memset(buffer, '\0', sizeof(buffer));
7069
unsigned fileIndex = fileIndexList_[i];
@@ -95,7 +94,7 @@ void SelectProjectView::DeleteProject() {
9594

9695
char buffer[32];
9796
npf_snprintf(buffer, sizeof(buffer), "Delete \"%s\"?", projectName);
98-
97+
9998
MessageBox *mb = new MessageBox(*this, buffer, MBBF_YES | MBBF_NO);
10099
DoModal(mb, DeleteProjectCallback);
101100
}

sources/Application/Views/SelectProjectView.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ class SelectProjectView : public ScreenView {
3939
etl::vector<int, MAX_FILE_INDEX_SIZE> fileIndexList_;
4040

4141
void DeleteProject();
42-
4342
};
4443
#endif

sources/Externals/SdFat/src/FatLib/FatFile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,6 @@ bool FatFile::rmdir() {
10881088
goto fail;
10891089
}
10901090
}
1091-
10921091
// convert empty directory to normal file for remove
10931092
m_attributes = FILE_ATTR_FILE;
10941093
m_flags |= FILE_FLAG_WRITE;

0 commit comments

Comments
 (0)