3 posts
Posted 22 April 2012 - 06:50 AM
Using TMI to generate a brand new floppy, putting it into a drive, then using disk.hasData("right") returns true. How would I get it to return false? I've checked the %APPDATA%/.minecraft/saves/test/disk/15 folder, and it's empty (as expected), and disk.getLabel("right") returns null.
1111 posts
Location
Portland OR
Posted 22 April 2012 - 07:39 AM
Try making one without using TMI and see if it has the same problem. It's probably an issue with the TMI crafted item.
1604 posts
Posted 22 April 2012 - 03:33 PM
I don't think that's what the function is made for. It returns true if there's a floppy disk on the drive, not if it has files on it. It would only return false if there's no disk or there's a music cd. To check if it has files you can do something like this:
function DiskHasData(side)
if disk.isPresent(side) and disk.hasData(side) then
local list = fs.list(disk.getMountPath(side))
return #list ~= 0
end
return false
end
3 posts
Posted 22 April 2012 - 04:27 PM
I don't think that's what the function is made for. It returns true if there's a floppy disk on the drive, not if it has files on it. It would only return false if there's no disk or there's a music cd. To check if it has files you can do something like this:
function DiskHasData(side)
if disk.isPresent(side) and disk.hasData(side) then
local list = fs.list(disk.getMountPath(side))
return #list ~= 0
end
return false
end
Yes, that works perfectly. Thanks!
1 posts
Posted 23 April 2012 - 11:03 AM
As far as i remember from diggout through code that method checks if there exist directory for inserted disk.
And folder for disk is created ehen you put it into disk drive :)/>/> so it returned allways true even for empty disks