Three levels of file system

BlackBox for Windows / Linux / OpenBSD / FreeBSD
https://github.com/bbcb/bbcp https://blackbox.oberon.org/download
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Three levels of file system

Post by Ivan Denisov »

With BlackBox you can have working directory (/USE), that is a kind of union mount technology over hosting OS.

However often BlackBox users extensively patching and extending framework with subsystems, so there are troubles with upgrading standard version.

To solve this issue F.V. Tkachov suggested to make third directory.
After the discussion we came to names:

STANDARD CUSTOM USE

Now you can put all your extensions (sybsystems, localization and patched files) into the CUSTOM directory.

With 1.8 you can try how it works.
https://blackbox.oberon.org/download
Attachments
WN832_dn6y8.jpg
Zinn
Posts: 123
Joined: Mon Nov 24, 2014 10:47 am
Location: Frankfurt am Main
Contact:

Re: Three levels of file system

Post by Zinn »

I test my program DosAbout on this version and get the system and the user directory.
How to get the custom directory in an application program?
Zinn
Posts: 123
Joined: Mon Nov 24, 2014 10:47 am
Location: Frankfurt am Main
Contact:

Re: Three levels of file system

Post by Zinn »

Without any change list plus the missing entry in the source header
e.g. HostFiles
- 20210116, bbcb, #045, restore Files interface to 1.6
- 20210517, bbcb, #0xx, Three levels of file system
It is difficult to find all changes and I need a very long time to proof them.

I have the following comments to the MODULE HostFiles in the version 1.8:

(1)
PROCEDURE NewLocator
the parenthesis is missing in line
IF (i > 1) & (loc.path[i-1] = "/") OR (loc.path[i-1] = "\") THEN loc.path[i-1] := 0X END;
correct is
IF (i > 1) & ((loc.path[i-1] = "/") OR (loc.path[i-1] = "\")) THEN loc.path[i-1] := 0X END;

(2)
Your implementation of move back to 1.6 is wrong. The correct move back to 1.6 is

Code: Select all

    PROCEDURE (f: File) NewWriter (old: Files.Writer): Files.Writer;
        VAR w: Writer;
    BEGIN    (* portable *)
        ASSERT(f.state # closed, 20);
        IF f.state # shared THEN
            IF (old # NIL) & (old IS Writer) THEN w := old(Writer) ELSE NEW(w) END;
            IF w.base # f THEN
                w.base := f; w.buf := NIL; w.SetPos(f.len)
            END;
            RETURN w
        ELSE
            RETURN NIL
        END
    END NewWriter;
(3)
I have not done the proof of "Three levels of file system" yet.
I don't understand why you use first & and second or in the line
IF ((res = fileNotFoundErr) OR (res = pathNotFoundErr)) & (isUseDir & isCustomDir) THEN
GetCustomDir(loc, fname);
and
IF ((res = fileNotFoundErr) OR (res = pathNotFoundErr)) & (isUseDir OR isCustomDir) THEN
GetStartupDir(loc, fname);

Sorry, it is a long way to a new version.

- Helmut
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Three levels of file system

Post by Ivan Denisov »

Zinn wrote:I test my program DosAbout on this version and get the system and the user directory.
How to get the custom directory in an application program?
Now it is impossible. We are discussing, what need to be done for it is be possible. No there is no way in Files to get text representation of locator.
I suggested in 2.0 to add prefix system and new procedure

Code: Select all

Files.dir.This('custom:').GetPath*(OUT path: ARRAY OF CHAR)
So it will be possible to get locator in custom directory and then extract it's text representation. Do you like this idea.

The same for use

Code: Select all

Files.dir.This('use:').GetPath*(OUT path: ARRAY OF CHAR)
and for standard directories

Code: Select all

Files.dir.This('standard:').GetPath*(OUT path: ARRAY OF CHAR)
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Three levels of file system

Post by Ivan Denisov »

Zinn wrote: (2)Your implementation of move back to 1.6 is wrong. The correct move back to 1.6 is
No. You provided text for realization with the fix of Ilya Ermakov. After discussion, we decided not apply Ilya fix, because it leads to later error detection. So we just fixed the documentation.

This is the version from 1.6:

Code: Select all

	PROCEDURE (f: File) NewWriter (old: Files.Writer): Files.Writer;
		VAR w: Writer;
	BEGIN	(* portable *)
		ASSERT(f.state # closed, 20); ASSERT(f.state # shared, 21);
		IF (old # NIL) & (old IS Writer) THEN w := old(Writer) ELSE NEW(w) END;
		IF w.base # f THEN
			w.base := f; w.buf := NIL; w.SetPos(f.len)
		END;
		RETURN w
	END NewWriter;
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Three levels of file system

Post by Ivan Denisov »

Zinn wrote:(3)
I have not done the proof of "Three levels of file system" yet.
I don't understand why you use first & and second or in the line
IF ((res = fileNotFoundErr) OR (res = pathNotFoundErr)) & (isUseDir & isCustomDir) THEN
GetCustomDir(loc, fname);
and
IF ((res = fileNotFoundErr) OR (res = pathNotFoundErr)) & (isUseDir OR isCustomDir) THEN
GetStartupDir(loc, fname);
If USE set, BlackBox tries to open the file from the USE dir first.

If CUSTOM set and USE not set, BlackBox tries to open the file from the CUSTOM dir first.

So, the first "&" we need to check CUSTOM dir after fail in USE dir.
The second "OR" we need to check STANDARD dir after fail in CUSTOM dir or in USE dir, if there is no CUSTOM dir set.
Zinn
Posts: 123
Joined: Mon Nov 24, 2014 10:47 am
Location: Frankfurt am Main
Contact:

Re: Three levels of file system

Post by Zinn »

Ivan Denisov wrote: I suggested in 2.0 to add prefix system and new procedure

Code: Select all

Files.dir.This('custom:').GetPath*(OUT path: ARRAY OF CHAR)
So it will be possible to get locator in custom directory and then extract it's text representation. Do you like this idea.

The same for use

Code: Select all

Files.dir.This('use:').GetPath*(OUT path: ARRAY OF CHAR)
and for standard directories

Code: Select all

Files.dir.This('standard:').GetPath*(OUT path: ARRAY OF CHAR)
Is this proposal accepted by the community?
Does a sample implementation already exist?

Or do still look for another solution?
What about the discussion to have some procedure in Dialog to get the path info?
e.g.
PROCEDURE Dialog.GetSystemDir (OUT dir: ARRAY OF STRING);
PROCEDURE Dialog.GetCustomDir (OUT dir: ARRAY OF STRING);
PROCEDURE Dialog.GetWorkingDir (OUT dir: ARRAY OF STRING);

Normal programs should not depend on this information.
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Three levels of file system

Post by Ivan Denisov »

There is no sample implementation yet. The discussion continues, however it is paused for now.

About your suggestion. I do not think, that this three layers is essential in the interface layer. This multi-layer directories structure is not simple to be the basis of BlackBox, so it should be hidden in the "Host" realization. The locator allows to make it elegant way with prefixes.

Ilya suggested more universal way. He thinks that there should be messages interface in Files for File and for Locator. So there will be Message to query desired information about paths...

The discussion continues.

There is the new loop for the discussion of Unicode in 1.8 version. Few days ago Boris forced the idea for elimination if Unicode module. He put all the code to the Strings module now. I am reviewing his changes in the dev18 branch now.
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Three levels of file system

Post by Ivan Denisov »

The paths "STANDARD:" and "CUSTOM:" now have experimental support in BlackBox 2.0
https://blackbox.oberon.org/
Zinn
Posts: 123
Joined: Mon Nov 24, 2014 10:47 am
Location: Frankfurt am Main
Contact:

Re: Three levels of file system

Post by Zinn »

In the description on page https://blackbox.oberon.org/download about Ubuntu/Mint/Debian repository for automatic upgrades version 1.8 the line
echo "deb http://deb... is double one with 18 and one without.

Where can I find the description about 2.0? Are you working in the way to merge BB Windows & BB Linux?
Is the new not MDI version the new standard?
Post Reply