TinyCircuits

SdFat and directories

dulsi

SdFat and directories
« on: June 13, 2018, 07:05:59 AM »
For my color monster game, I've been looking into SdFat. I've been able to write to a file in the root directory. I haven't been able to write a file in a subdirectory. I'd much rather save information in the game directory than in root. I did tried this:
Code: [Select]
dataFile.open("colormonster/colormn1.dat", O_WRITE | O_CREAT | O_TRUNC)Anybody know what I'm doing wrong?

dulsi

Re: SdFat and directories
« Reply #1 on: June 14, 2018, 10:09:38 PM »
I downloaded the source code to SuperOteme. I copied the SdFat library from it. That works. I'm not pleased with this solution as I don't want to keep a copy of that source in my project. It also makes it difficult for my simulator to support it.

Has anyone gotten the SdFat library in Arduino IDE working? Do I need to initialize it differently or maybe alter the SdFatConfig.h settings?

dulsi

Re: SdFat and directories
« Reply #2 on: June 16, 2018, 11:09:55 AM »
Grrr... The SdFat library I copied from SuperOteme is not working. It creates the file in the subdirectory but fails to write to it. I'm unsure if it did work and started failing or if I never checked the file size and it never worked.

For the time being I've gone back to the Arduino IDE SdFat library and store files in the main directory.