Why would be the same name? |
For example, you merged two directories and there happened to be files with the same name and different contents.
You are not talking about case, I presume. |
No, exact same name. They're indistinguishable by just looking at the file name.
You do need some unique identifier for each file. The concept of (shown) name not to be that identifier is ... interesting. |
Yes, that's exactly what I'm doing. The identifier is whatever ID the database assigned to the row when it was inserted.
Yes, if they are different revisions of the same file as in git. |
No, my system is fundamentally incapable of dealing with file mutability, so file history is meaningless as a concept.
What would be the problem solved by this? |
While I understand
why they exist, I've always thought the restrictions file systems impose on file names to be too arbitrary, and when I started to design the system I wanted to stay away from any decisions that would make the system unnecessarily inflexible. Actually, I think as data organization systems, file systems are wholly inadequate. Ooh, I can put related files in a directory. Whoop-de-doo!
What I'm working on is an image library system that lets you organize files both by metadata (e.g. author, date, contents) and by a user-defined directory tree (like a regular file system). So, you enter a directory and you see both subdirectories and files, represented as thumbnails.
Actually, after posting the OP I started to realize that file names
for files are redundant. If you can already look at the contents in a good-enough preview, the file name adds no new information. At best it gives the system a hint on how to initially sort them, if order is important (e.g. the directory contains scans of pages from a publication).
Even for directories the file name can be made redundant to some extent, because a feature I will implement eventually is the ability to set a "cover" for the directory so you can scan the listing visually. Actually I have a screenshot I made a few years ago of how it might look like (I've been trying to scratch this itch for a good while):
https://ibb.co/k31f8kY
It does make paths a bit unwieldy, but with any luck the user never will never have to deal with them:
[1746197,"20200622.jpg",]
["test","1320885.gif",]
(The comma at the end is optional, but serializers always add them. Quotes distinguish file names from IDs. IDs allow referencing a deep directory directly, even if its location in the tree changes.)