|
Post by donnybowers on Feb 24, 2019 2:20:24 GMT -5
I can't get the "FILES" command to read in the directories. I created a directory with the following subfolders: folder1 folder2
and the following files: fileDialog.bas files.bas files accessor.bas
The program reads the files but not the subfolders.
Here's the code:
'-- files.bas --
dim info$(10, 10) files DefaultDir$, "*.*", info$() numfiles=val(info$(0,0)) numdirs=val(info$(0,1)) print "Folders "; print numdirs print "--------" for i=numfiles+1 to numfiles+numdirs d$=info$(i,1) print d$ next i print "" print "Files "; print numfiles print "--------" for i=1 to numfiles f$=info$(i,0) print f$ next i
Here's the result I get:
Folders 0 --------
Files 3 -------- files.bas files accessor.bas fileDialog.bas
If I run it in LB 4 or JustBASIC I get:
Folders 2 -------- folder1 folder2
Files 3 -------- files.bas files accessor.bas fileDialog.bas
I'm running LB5-347 alpha on LinuxLite 4.2 (64 bit), which is a flavor of Ubuntu.
Just wondering if this is something that isn't implemented yet, or if it's something with the new dialect.
|
|
|
Post by metro on Feb 24, 2019 2:40:02 GMT -5
I can't get the "FILES" command to read in the directories. I created a directory with the following subfolders: folder1 folder2 and the following files: fileDialog.bas files.bas files accessor.bas The program reads the files but not the subfolders. +1 I get the same problem with Linux version, however running the same code under wine (with editor display issue) the your code give the correct result. (two sub folders) could this be related to my earlier post where the sub-folder is not recognised in the file dialog
|
|
|
Post by Chris Iverson on Feb 24, 2019 2:52:33 GMT -5
Yup, I see this as well, on my Ubuntu box.
I expect to see it on my Pi, too, but I haven't had a chance to test it there yet.
|
|
|
Post by Carl Gundel on Apr 3, 2019 22:21:49 GMT -5
I can't get the "FILES" command to read in the directories. I created a directory with the following subfolders: folder1 folder2 and the following files: fileDialog.bas files.bas files accessor.bas The program reads the files but not the subfolders. Try this: 'Demo of new files accessor object. Old files syntax is also still valid.
print "Directories:" if Platform$ = "win32" then files #dir, DefaultDir$+"*" else 'assume Mac OS or Linux files #dir, "*" end if #dir dateformat("mmm dd, yyyy") while #dir hasAnswer() #dir nextFile$() if #dir isdir() then print #dir name$(); "|"; print #dir size(); "|"; print #dir date$(); "|"; print #dir time$() end if wend
print
print "Files:" if Platform$ = "win32" then files #dir, DefaultDir$+"*" else 'assume Mac OS or Linux files #dir, "*" end if #dir dateformat("mmm dd, yyyy") while #dir hasAnswer() #dir nextFile$() if #dir isdir() = 0 then print #dir name$(); "|"; print #dir size(); "|"; print #dir date$(); "|"; print #dir time$() end if wend
|
|
|
Post by Chris Iverson on Apr 4, 2019 10:00:01 GMT -5
This is what I got as a result of running your code, Carl:
Directories: bas_files|12288|Mar 25, 2019|16:57:38 vcruntime|4096|Mar 25, 2019|16:57:37
Files: lb5alpha.exe|824760|Mar 18, 2019|00:49:09 lb5alpha.im|21701076|Mar 18, 2019|00:49:09 Records.db|8192|Mar 25, 2019|16:58:58 rpi-alpha|761568|Mar 18, 2019|00:49:09 error.log|2361|Mar 25, 2019|16:56:23 alphaTestNotes.txt|4172|Mar 18, 2019|00:49:09 sqlite3.dll|858084|Mar 18, 2019|00:49:09 lin32-348|753760|Mar 18, 2019|00:49:09
So the new syntax works, but the old syntax(which is documented as still being valid) does not appear to do so. I do notice the change you make in whether or not you specify DefaultDir$ to the files accessor, but I don't think the old FILES syntax will let you NOT specify a directory.
|
|