Page 1 of 2

Three levels of file system

Posted: Wed May 12, 2021 4:31 am
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

Re: Three levels of file system

Posted: Sat May 15, 2021 12:54 pm
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?

Re: Three levels of file system

Posted: Mon May 17, 2021 5:44 am
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

Re: Three levels of file system

Posted: Mon May 17, 2021 5:57 am
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)

Re: Three levels of file system

Posted: Mon May 17, 2021 6:08 am
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;

Re: Three levels of file system

Posted: Mon May 17, 2021 6:22 am
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.

Re: Three levels of file system

Posted: Thu Jun 17, 2021 6:35 am
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.

Re: Three levels of file system

Posted: Fri Jun 18, 2021 4:51 pm
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.

Re: Three levels of file system

Posted: Tue Feb 15, 2022 12:01 pm
by Ivan Denisov
The paths "STANDARD:" and "CUSTOM:" now have experimental support in BlackBox 2.0
https://blackbox.oberon.org/

Re: Three levels of file system

Posted: Thu Feb 17, 2022 6:34 am
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?