index folders by path rather than name

When resolving remote files, folders were indexed by its base name
rather than the full path, making duplicate folder names unsupported.

When creating new folders, the folder index was not updated correctly,
leading to the same folder being created multiple times.

Both are fixed by using the full path when creating the index, when
checking the index, and when updating the index.