[Bug] `vault.createFolder` doesn't register in filebrowser on mobile if creating nested folders

When creating a nested folder via vault.createFolder, e.g. vault.createFolder('2024/August') Only the 2024 folder will show up in mobile fileBrowser on IOS, but the nested folder will be created. Any files added to the nested folder will also not show up until restarting the app.

However, there is a workaround if anyone else runs into this. Simply split the path and create each nested folder individually, e.g. vault.createFolder('2024') then vault.createFolder('2024/August')

import path from "path-browserify";

const folderName = "Journal/2023/August"

let prevPath = "";
folderPath.split(path.sep).forEach((folderName) => {
	const cascadePath = path.join(prevPath, folderName);
    // Assumes in context of `this.app`
	if (!this.app.vault.getAbstractFileByPath(cascadePath)) {
		this.app.vault.createFolder(cascadePath);
	}
	prevPath = cascadePath;
});
1 Like