06.01.2012, 20:42
(
Последний раз редактировалось Terminator3; 13.02.2012 в 17:03.
)
This is a continuation and refinement rather my previous plugin with that name klik
Functions:
DIR: DirOpen(const dirname[])
opens the directory to read it (You can open up to 32 folders at the same time)
DirClose(DIR:dir)
closes open directory
DirRead(DIR:dir, name[])
Gets the name and type of element from directory
DirRewind(DIR:dir)
Function moves a place to start reading a folder
DirCreate(const name[], mode = 420)
Creates a directory
Rename(const oldname[], const newname[])
Renames a file / directory or move it to another location
CheckPath(const patch[])
Checks the type of element
DirRemove(const name[], bool:empty = false)
Removes a directory and all subfolders and files inside
Chmod(const patch[], mode)
Sets the chmod of a directory/file
Linux
(names are the same in my dir.inc)
*Types of element (definitions):
type_unknown - not found or unknown type
type_dir - directory
type_file - file
type_other - other type
if you want to use chmod on Windows and you script gonna work only on Windows paste
above
DOWNLOAD:
Windows .dll
Linus .so (on Ubuntu 11.04)
Includ .inc
and
soucre code
Mirror:
Direct download (all files)
Example:
Functions:
DIR: DirOpen(const dirname[])
opens the directory to read it (You can open up to 32 folders at the same time)
- const dirname[] - name of a directory
DirClose(DIR:dir)
closes open directory
- DIR:dir - id of a directory returned by DirOpen
DirRead(DIR:dir, name[])
Gets the name and type of element from directory
- DIR:dir - id of a directory returned by DirOpen
- name[] - return name of element
DirRewind(DIR:dir)
Function moves a place to start reading a folder
- DIR:dir - id of a directory returned by DirOpen
DirCreate(const name[], mode = 420)
Creates a directory
- const name[] - name of a directory
- mode - chmod, unused on Windows
Rename(const oldname[], const newname[])
Renames a file / directory or move it to another location
- const oldname[] - old name of a file/directory or the old localization
- const newname[] - new name of a file/directory or the new localization
CheckPath(const patch[])
Checks the type of element
- const patch[] - name of file/directory
DirRemove(const name[], bool:empty = false)
Removes a directory and all subfolders and files inside
- const name[] - name of a directory
- bool:empty = false - if you know the directory is empty set this to true
Chmod(const patch[], mode)
Sets the chmod of a directory/file
- const patch[] - name of element
- mode - mode, e.g. S_IREAD | S_IWRITE | S_IRGRP | S_IROTH or IntToOctal(644)
Linux
(names are the same in my dir.inc)
*Types of element (definitions):
type_unknown - not found or unknown type
type_dir - directory
type_file - file
type_other - other type
if you want to use chmod on Windows and you script gonna work only on Windows paste
pawn Код:
#define WIN32
//or
#define WIN
pawn Код:
#include <dir>
Windows .dll
Linus .so (on Ubuntu 11.04)
Includ .inc
and
soucre code
Mirror:
Direct download (all files)
Example:
pawn Код:
new str[100],
type,
DIR:xxx = DirOpen("."); // scriptfiles
if(!xxx)
return print("directory not found");
type = DirRead(xxx, str);
while(str[0])
{
printf("\'%s\' type: %d", str, type);
type = DirRead(xxx, str);
}
DirClose(xxx);