Dateirechte: FileWriteAccess, FileReadAccess, FileExecAccess
Übersicht

E. Urbachehemals "Basicprogger"Betreff: Dateirechte: FileWriteAccess, FileReadAccess, FileExecAccess |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Beispiel:
Code: [AUSKLAPPEN] SuperStrict
Local file:String = AppArgs[0] Print file Print "Write: " + FileWriteAccess(file) Print "Read: " + FileReadAccess(file) Print "Exec: " + FileExecAccess(file) Code: Code: [AUSKLAPPEN] Function FileWriteAccess:Int(path:String)
Return CheckPermissions(path, 2) End Function '?Linux Function FileReadAccess:Int(path:String) Return CheckPermissions(path, 4) End Function Function FileExecAccess:Int(path:String) Return CheckPermissions(path, 1) End Function '? Rem ?Win32 Function FileReadAccess:Int(path:String) Return 1 End Function Function FileExecAccess:Int(path:String) Return 1 End Function ? End Rem Extern "c" Function access_( path$z, mode:Int )="access" End Extern Function CheckPermissions:Int(path:String, amode:Int) FixPath path Return access_(path, amode) = 0 End Function Function CheckPermissions2:Int(path:String, amode:Int) FixPath path Local mode:Int, size:Int, mtime:Int, ctime:Int If stat_(path, mode, size, mtime, ctime) Return 0 Return ((mode & ~S_IFMT_) & amode) <> 0 End Function Beschreibung: FileWriteAccess liefert 1 zurück, wenn man Schreibrechte für die durch den Parameter path angegebene Datei hat, andernfalls 0. FileReadAccess prüft die Leserechte (Rückgabewert wie bei FileWriteAccess) FileExecAccess prüft die Rechte zum Ausführen von Dateien (Rückgabewert wie bei FileWriteAccess). Mit CheckPermissions kann man Rechte für andere Nutzer testen, aber die Benutzung dieser Funktion möchte ich nicht erklären, da sie auch nur sehr selten benötigt wird. |
||
The box said, "Requires Windows XP or better", so I installed Ubuntu | Linux is NOT Windows
Flua :: Profiler für BB und BMax :: Partikel-Engine für BMax :: Lyphia-Projekt Quellcode (BMax) :: Automatische Parallelisierung :: Meine Musik |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group