mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
parent
24d3a0ae66
commit
2212ee5d93
@ -73,6 +73,27 @@ const char* getDrivePath(void) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Drive getDriveFromPath(const char *path) {
|
||||
Drive destDrive = currentDrive;
|
||||
if(strncmp(path, "sd:", 3) == 0) {
|
||||
return Drive::sdCard;
|
||||
} else if(strncmp(path, "fat:", 4) == 0) {
|
||||
return Drive::flashcard;
|
||||
} else if(strncmp(path, "ram:", 4)) {
|
||||
return Drive::ramDrive;
|
||||
} else if(strncmp(path, "nand:", 5)) {
|
||||
return Drive::nand;
|
||||
} else if(strncmp(path, "photo:", 6)) {
|
||||
return Drive::nandPhoto;
|
||||
} else if(strncmp(path, "nitro:", 6)) {
|
||||
return Drive::nitroFS;
|
||||
} else if(strncmp(path, "img:", 4)) {
|
||||
return Drive::fatImg;
|
||||
}
|
||||
|
||||
return currentDrive;
|
||||
}
|
||||
|
||||
void fixLabel(char* label) {
|
||||
for (int i = strlen(label) - 1; i >= 0; i--) {
|
||||
if(label[i] != ' ') {
|
||||
|
||||
@ -39,6 +39,7 @@ extern u64 imgSize;
|
||||
extern u32 ramdSize;
|
||||
|
||||
extern const char* getDrivePath(void);
|
||||
extern Drive getDriveFromPath(const char *path);
|
||||
|
||||
extern bool nandFound(void);
|
||||
extern bool photoFound(void);
|
||||
|
||||
@ -220,7 +220,7 @@ bool fcopy(const char *sourcePath, const char *destinationPath) {
|
||||
getDirectoryContents(dirContents);
|
||||
|
||||
// Check that everything will fit
|
||||
if(dirSize(dirContents) > driveSizeFree(currentDrive)) {
|
||||
if(dirSize(dirContents) > driveSizeFree(getDriveFromPath(destinationPath))) {
|
||||
font->clear(false);
|
||||
font->printf(0, 0, false, Alignment::left, Palette::white, (STR_FILE_TOO_BIG + "\n\n" + STR_A_OK).c_str(), sourcePath);
|
||||
font->update(false);
|
||||
@ -258,7 +258,7 @@ bool fcopy(const char *sourcePath, const char *destinationPath) {
|
||||
}
|
||||
|
||||
// Check that the file will fit
|
||||
if((u64)fsize > driveSizeFree(currentDrive)) {
|
||||
if((u64)fsize > driveSizeFree(getDriveFromPath(destinationPath))) {
|
||||
font->clear(false);
|
||||
font->printf(0, 0, false, Alignment::left, Palette::white, (STR_FILE_TOO_BIG + "\n\n" + STR_A_OK).c_str(), sourcePath);
|
||||
font->update(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user