B4A Library File handling library

gilson lopes

New Member
Licensed User
Longtime User
Mount cifs

It's possible I mount a drive? Ex:{ mount -t cifs -o user="guest" //192.168.1.1/test /mnt/sdcard/servershared } , if yes , need root ?
Tanks.
 

HotShoe

Well-Known Member
Licensed User
Longtime User
It's possible I mount a drive? Ex:{ mount -t cifs -o user="guest" //192.168.1.1/test /mnt/sdcard/servershared } , if yes , need root ?
Tanks.

Yes it is, and yes you'll need root to mount the drive.

--- Jem
 

johnaaronrose

Active Member
Licensed User
Longtime User
4GB Fat32 sdcard

I have been using this library on a 1GB Fat16 sdcard. It worked fine in finding the used area size. However, I've just moved to a 4GB Fat32 sdcard (as the 1GB sdcard was almost full) with all directories & files copied from the sdcard. I've used up some more space on the new sdcard so that it now uses a little over 1GB for directories & files. Both Astro & ES File Explorer correctly show the sdcard as having almost 3GB free. However, using this library (version 1.41), my app shows that the sdcard is more than full. Please check if there is a bug in the library.
 

HotShoe

Well-Known Member
Licensed User
Longtime User
I'll do that over the weekend. Thanks for reporting this.

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Both Astro & ES File Explorer correctly show the sdcard as having almost 3GB free. However, using this library (version 1.41), my app shows that the sdcard is more than full. Please check if there is a bug in the library.

I have made a change to the library. Please see if it corrects the problem on your device(s). See the first post and get the 1.42 version.

Thanks,

--- Jem
 

johnaaronrose

Active Member
Licensed User
Longtime User
1.42 version still has problem with 4GB sdcard

Clem,

1.42 version still has problem with 4GB sdcard. For example with empty 4GB sdcard using Emulator, your libtest app displays free space correctly (i.e. 3.98GB) using the GetGigsFree method but (after I modified it to also include the GetFreeSpace method) it displays it incorrectly using GetFreeSpace (i.e. as -16769024bytes). Fragment of code from my app:


So it looks like GetGigsFree delivers the correct result but Get FreeSpace delivers an incorrect result on a 4GB sdcard. Thought that occurs to me is that the GetFreeSpace method uses a variable defined as Int rather than Long. Is that the problem?
 
Last edited:

HotShoe

Well-Known Member
Licensed User
Longtime User
Hi John,

Ever ignore a simple calculation because it has to be right? Well, that's what I did. Version 1.43 is now available in the first post. Please try that version and let me know if it works on your end.

Thanks,

--- Jem
 

johnaaronrose

Active Member
Licensed User
Longtime User
OK now

Jem,

GetFreeSpace method gives correct figure now.

Thank you.

Hi John,

Ever ignore a simple calculation because it has to be right? Well, that's what I did. Version 1.43 is now available in the first post. Please try that version and let me know if it works on your end.

Thanks,

--- Jem
 

Stulish

Active Member
Licensed User
Longtime User
Jem,

is the link to jcifs.zip still working, i cant seem to connect.

I have been trying to open a file on my network server, will this library enable me to do this??

cheers

Stu
 
Last edited:

HotShoe

Well-Known Member
Licensed User
Longtime User

Stulish

Active Member
Licensed User
Longtime User
Thanks Jem,

Another Stupid noob question from me (trying to get my head around Samba and file systems)

is there an example of using the smbInStream and could i use this to open a file that is on a network drive???

I have been trying to link my phone to my network drive as a file manager, and if i click the item i want it to open in the default app.

my post is http://www.b4x.com/forum/basic4android-updates-questions/24518-open-file-network-drive.html with a copy of my basic app to trying out file management.

Is what i am trying to accomplish not available in B4A, as
thedesolatesoul said i may have to copy the file to the local device first (but i have other android devices that stream movies and audio from the drive)??

Thanks, and help making a think guy understand is much appreciated :sign0104:
 

HotShoe

Well-Known Member
Licensed User
Longtime User
hi Stulish,

Sorry for the delay, family and friends events are taking most of my time til after Christmas. This 10 day holiday is likely the only vacation time I get this year.

I'll try to write an example using smbinfile. It is the least tested method in the library and was intended to stream to a b4a object like an audio player. An external app should just take the encoded url of the file.

--- Jem
 

Stulish

Active Member
Licensed User
Longtime User
Thanks Jem, your a star

I have family over too so not on much at the moment also

Have a nice holiday

 

FabioG

Active Member
Licensed User
Longtime User
Hello,

you can add the ability to check if a file exists in MLfiles ?
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Hello,

you can add the ability to check if a file exists in MLfiles ?

Done. Version 1.4.4 is now available in the first post. It now has the Exists method. I can't believe I have overlooked that for this long. Thanks FabioG!

--- Jem
 

FabioG

Active Member
Licensed User
Longtime User
Done. Version 1.4.4 is now available in the first post. It now has the Exists method. I can't believe I have overlooked that for this long. Thanks FabioG!

--- Jem

perfect!

Thank you very much!
 

FabioG

Active Member
Licensed User
Longtime User
Hello,

I have a problem with this code

B4X:
Dim MLFiles1 As MLfiles
MLFiles1.GetRoot

If MLFiles1.Exists("/data/misc/wifi/softap.conf") = True Then
   Dim WiFiConfig() As String
   Dim WiFiConfigStr As String
   WiFiConfigStr = MLFiles1.ReadTxtFile("/data/misc/wifi/softap.conf")
        Label_WiFiConfig.Text = "WiFi Network: " & WiFiConfig(0) & " Key: " & WiFiConfig(1)
End If

the file exists and is a text file
but the command "MLFiles1.ReadTxtFile" can not read its contents because "MLFiles1.Exists" in reality not find the file.

how can I fix this?

thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…