diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-01-13 01:59:32 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-01-13 01:59:32 +0300 |
commit | 13084f6566c536df08430cce6c584f5e5c06b5a8 (patch) | |
tree | 44765c911f8a5850ee3d18147658b29b0eba0726 /src/Storage/FileStore.cpp | |
parent | d935cc8c828e44430f6a4dc2eacf53c04268fe96 (diff) |
Various
Refactored how GCode blocks and indentation are tracked
Fixed lack of motor movement on Duet 3
Create path recursively if needed when creating a directory or renaming
a file
Diffstat (limited to 'src/Storage/FileStore.cpp')
-rw-r--r-- | src/Storage/FileStore.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/Storage/FileStore.cpp b/src/Storage/FileStore.cpp index 284aa956..c3d2643d 100644 --- a/src/Storage/FileStore.cpp +++ b/src/Storage/FileStore.cpp @@ -64,29 +64,9 @@ bool FileStore::Open(const char* filePath, OpenMode mode, uint32_t preAllocSize) if (writing) { - // Try to create the path of this file if we want to write to it - String<MaxFilenameLength> filePathCopy; - filePathCopy.copy(filePath); - - size_t i = (isdigit(filePathCopy[0]) && filePathCopy[1] == ':') ? 2 : 0; - if (filePathCopy[i] == '/') + if (!MassStorage::EnsurePath(filePath)) { - ++i; - } - - while (i < filePathCopy.strlen()) - { - if (filePathCopy[i] == '/') - { - filePathCopy[i] = 0; - if (!MassStorage::DirectoryExists(filePathCopy.GetRef()) && !MassStorage::MakeDirectory(filePathCopy.c_str())) - { - reprap.GetPlatform().MessageF(ErrorMessage, "Failed to create folder %s while trying to open file %s\n", filePathCopy.c_str(), filePath); - return false; - } - filePathCopy[i] = '/'; - } - ++i; + return false; } // Also try to allocate a write buffer so we can perform faster writes |