Support for long file names in file transfer

Support forum for MegunoLink
Post Reply
strud
Posts: 20
Joined: Sat Nov 18, 2023 6:51 am

Sat Dec 16, 2023 9:24 pm

During my work to implement and debug the file transfer mechanism in my project, I figured out a method to support long filenames from the microcontroller side.

In the function GetFileName within SDFatFileManager.h, I changed the definition of a local char array to be larger:

Code: Select all

   virtual const char* GetFilename(SdfmFile hFile) override 
    { 
      //static char achFilenameBuffer[13];
      static char achFilenameBuffer[m_maxFilenameLength];   // edited CDS 14-12-23
      hFile.getName(achFilenameBuffer, sizeof(achFilenameBuffer));
      return achFilenameBuffer;
    };
Where m_maxFilenameLength is defined in the header file as:

Code: Select all

 static const int m_maxFilenameLength = 100;
Note that this only enables long filenames from the microcontroller side to the PC, but it does work nicely.
longFileNameTransfer.png
longFileNameTransfer.png (36.78 KiB) Viewed 2947 times
Post Reply