TFile-.* behaviour (long)

Mariusz Stanczak (MStanczak@sprintmail.com)
Mon, 30 Mar 1998 23:50:53 -0800


I get rather strange results under WinNT:

the current keyboard layout is 437
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 2.00/03 28 March 1998 *

TFile->pwd always returns "/" as the current directory:

root [2] TFile test("test.root")
root [3] test.ls()
TFile** test.root
TFile* test.root
root [4] test.mkdir("dir1l1")
(class TDirectory*)0xa0e118
root [5] test.ls()
TFile** test.root
TFile* test.root
TDirectory* dir1l1 dir1l1
root [6] test.pwd()
test.root:/
root [7] test.cd("dir1l1")
root [8] test.pwd()
test.root:/

New files are created in the right directory, but how is one to keep track
where in the directory tree one is at a given moment?

root [18] test.mkdir("dir1l2")
(class TDirectory*)0xa0e998
root [19] test.ls()
TFile** test.root
TFile* test.root
TDirectory* dir1l1 dir1l1
TDirectory* dir1l2 dir1l2

Further, it is possible to create "invalid" directory names... in the
following
if ROOT is to mimic the directory behaviour of an OS file system the
command;

root [21] test.mkdir("dir2l2/dir1l3")

would be expected to create directory "dir2l2" and "under" it a subdirectory
"dir1l3" but the result is;

(class TDirectory*)0xa0fa18
root [22] test.ls()
TFile** test.root
TFile* test.root
TDirectory* dir1l1 dir1l1
TDirectory* dir1l2 dir1l2
TDirectory* dir2l2/dir1l3 dir2l2/dir1l3

and since the "/" is a directory seperator, all other operations fail unless
the "/" is escaped:

root [23] test.cd("dir2l2/dir1l3")
Error in <TFile::cd>: Unknown directory dir2l2
root [24] test.Delete("dir2l2\/dir1l3")

Lastly, deleted files still show in the directoy listing:

root [35] test.ls()
TFile** test.root
TFile* test.root
TDirectory* dir1l1 dir1l1
TDirectory* dir1l2 dir1l2
TDirectory* dir2l2/dir1l3 dir2l2/dir1l3
root [36] gDirectory.pwd()
test.root:/dir1l1
root [37] test.Delete("dir2l2")
root [38] test.ls("dir2l2")
TFile** test.root
TFile* test.root
root [39] test.ls()
TFile** test.root
TFile* test.root
TDirectory* dir1l1 dir1l1
TDirectory* dir1l2 dir1l2
TDirectory* dir2l2/dir1l3 dir2l2/dir1l3
[...]
root [42] test.cd("/")
root [43] gDirectory.pwd()
test.root:/
root [44] test.Delete("dir1l1")
root [45] test.ls()
TFile** test.root
TFile* test.root
TDirectory* dir1l1 dir1l1
TDirectory* dir1l2 dir1l2
TDirectory* dir2l2/dir1l3 dir2l2/dir1l3

Is there a way to synchronize the display with the real state of a file?

Thanks,

/Mariusz

---
MStanczak@sprintmail.com