SOLVED - DiskFree() on linux lazarus / 1-Linux ---------------------------------------------------------------------- wjackson153 · 2013-01-04 21:20 According to FPC doumentation, Code: [Select]Remark: Under Linux, and Unix in general, the concept of disk is different than the dos one, since the filesystem is seen as one big directory tree. For this reason, the DiskFree and DiskSize functions must be mimicked using filenames that reside on the partitions. For more information, see AddDisk. So i presume AddDisk('/home/user/somefile');     // Should work the same as AddDisk(0); one windows ??? so one would think DiskFree('/home/user/somefile');     //  One would assume the same would work for this function? Anyone using linux that is familar with the proper usage of this function? Documentation on linux is not really all that detailed. All im really trying to do is get the drives size using the above method. Thanks. ---------------------------------------------------------------------- Blaazen · 2013-01-04 21:33 I never worked with this under Widnows. I just tried (note that DiskFree don't want string-path as argument): Code: [Select]WriteLn('DiskFree '+inttostr(DiskFree(AddDisk('/home/v1'))));and returns 18569633792 (~18GB) which is correct. ---------------------------------------------------------------------- wjackson153 · 2013-01-04 21:49 Thanks Blaazen Exactly what I needed I was trying to pass the path as  arguments for both AddDisk() and DiskSize() ---------------------------------------------------------------------- Gizmo · 2015-08-16 22:38 Stumbled across this and thought it worth pointing out that AddDisk requires the PATH of the file, not the path and filename (I think that is what Blaazen meant but I didn't understand it until some trial and error took place). So Code: [Select] lblFreeSpaceReceivingDisk.Caption:= ('(Free space:' + inttostr(DiskFree(AddDisk(ExtractFilePath(SaveDialog.Filename)))) + ')'); will report the free space of any selected output on any selected drive. Whereas the following will fail and return -1 Code: [Select] lblFreeSpaceReceivingDisk.Caption:= ('(Free space:' + inttostr(DiskFree(AddDisk(SaveDialog.Filename)))) + ')'); and the following will only ever returns the free space of the disk from which the program is running from (typically the host OS drive): Code: [Select] lblFreeSpaceReceivingDisk.Caption:= ('(Free space:' + inttostr(DiskFree(0))) + ')');