1 | Let's make a decent "file manager".
|
2 |
|
3 | A file manager should know which areas of the file system are safe and which are not.
|
4 |
|
5 | (Some areas are not safe to modify, e.g. OS directories. And some areas may not even be safe to read, e.g. because reading there is "expensive".)
|
6 |
|
7 | So a file manager would have a set of assumptions.
|
8 |
|
9 | Let's put those in a file, e.g. "assumptions.txt". Simple lines of English text will suffice, like this:
|
10 |
|
11 | / is the root of everything.
|
12 | / is generally not safe.
|
13 | /usr is generally not safe. // This follows from previous line.
|
14 | /home/stefan is safe (except for symlinks of course).
|
15 | /home/<somethingelse> is generally not safe. // Also follows from all of the above.
|
16 |
|
17 | By default (before loading any assumptions), a file manager will take the assumption that nothing is safe. This is BECAUSE IT IS A REAL PROGRAM ON A REAL COMPUTER AND IT SHOULD BETTER BE SAFE TO RUN which means it is in a war zone which means it should defaultly assume unsafety of its environment. :]
|
18 |
|
19 |
|
20 | Applications
|
21 | ------------
|
22 |
|
23 | The file manager will feature different sub-applications, for example one to backup up data.
|
24 |
|
25 | A simple example task would be: "Backup all safe areas" which could make, say, a zip file of all these areas.
|
26 |
|
27 |
|
28 | What we need
|
29 | ------------
|
30 |
|
31 | A directory scanner that
|
32 | -travels only safe areas
|
33 | -does not follow symlinks (corollary of the above as following a symlink can take you out of a safe area).
|