mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 11:43:47 +00:00
Fetch longname when a file exists
This commit is contained in:
parent
0ddb4d88a9
commit
660420050b
@ -628,11 +628,17 @@ void CardReader::openFileWrite(char * const path) {
|
||||
|
||||
//
|
||||
// Check if a file exists by absolute or workDir-relative path
|
||||
// If the file exists, the long name can also be fetched.
|
||||
//
|
||||
bool CardReader::fileExists(const char * const path) {
|
||||
if (!isMounted()) return false;
|
||||
SdFile *diveDir = nullptr;
|
||||
const char * const fname = diveToFile(false, diveDir, path);
|
||||
if (fname) {
|
||||
diveDir->rewind();
|
||||
selectByName(*diveDir, fname);
|
||||
diveDir->close();
|
||||
}
|
||||
return fname != nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user