Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Root paths for different platforms — Gideros Forum

Root paths for different platforms

n1cken1cke Maintainer
edited June 2016 in General questions
I am working on File Explorer example (thx to LFS plugin) and I need to know "root paths". For example on Windows platform I can get available root paths with following check:
local function getDisks()
	local lfs = require "lfs"
	local disks = {}
	for i = 65, 90 do
		local letter = string.char(i)
		local att = lfs.attributes(letter..":/.")
		if att then table.insert(disks, letter..":") end
	end
	return disks --> {"C:", "D:", "E:"...}
end
But how to get them for other platforms correctly?
For example on Android I need to look at available root paths from installed file manager. I found path to my sdcard: "/storage/sdcard0" and I can work with it but I don't think every other Android device has same path.
Can I somehow get root paths for all platforms from Gideros? Or this is not possible without some extra plugin?

Comments

  • ar2rsawseenar2rsawseen Maintainer
    can't you just list everything in / and it should be there including sd and storage

    Likes: n1cke

    +1 -1 (+1 / -0 )Share on Facebook
  • n1cken1cke Maintainer
    @ar2rsawseen, thank you very much!
    It works perfect for Android and iOS:
    for name in lfs.dir "/." do print("/"..name) end
    And of course it should work on MacOS and Linux.
    Hovewer on Windows that `getDisks` function still must be used because "/." only gives you content of the disk with installed Windows.
    Not sure about WinRT.
  • ar2rsawseenar2rsawseen Maintainer
    yes, now it seems it is easier to do on unix systems, right? :D

    Likes: n1cke

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.