26 #include "gapi_dir_operations.h"
27 #include "gapi_file_operations.h"
28 #include "gapi_stat.h"
37 fWorkingDirectory[0] =
'\0';
66 Error(
"TAlienSystem",
"You are not connected to AliEn");
73 Info(
"OpenDirectory",
"Assuming an AliEn URL alien://%s",dirname);
76 return gapi_mkdir(url.
GetUrl(),0);
87 Info(
"OpenDirectory",
"Assuming an AliEn URL alien://%s",name);
90 return (
void*) gapi_opendir(url.
GetUrl());
98 gapi_closedir( (GAPI_DIR*)ptr);
107 struct dirent* retdir;
108 retdir = gapi_readdir( (GAPI_DIR*) ptr);
111 return retdir->d_name;
125 Info(
"OpenDirectory",
"Assuming an AliEn URL alien://%s",dirname);
128 return gapi_chdir(url.
GetUrl());
149 Error(
"TAlienSystem",
"You are not connected to AliEn");
165 if (dirname.
Length()==0) {
198 return gapi_rename(oldname,newname);
226 return gapi_unlink(filename);
247 int res =
GetPathInfo(path,
id, &lsize, flags, modtime);
249 if (res == 0 && size) {
251 Error(
"GetPathInfo",
"file %s > 2 GB, use GetPathInfo() with Long64_t size", path);
323 Info(
"AlienFilestat",
"Assuming an AliEn URL alien://%s",fpath);
326 #if defined(R__SEEK64)
328 if ((gapi_lstat(url.
GetUrl(), (GAPI_STAT*)(&sbuf))) == 0) {
331 if ((gapi_lstat(url.
GetUrl(), (GAPI_STAT*)(&sbuf))) == 0) {
333 buf.
fIsLink = S_ISLNK(sbuf.st_mode);
334 buf.
fDev = sbuf.st_dev;
335 buf.
fIno = sbuf.st_ino;
336 buf.
fMode = sbuf.st_mode;
337 buf.
fUid = sbuf.st_uid;
338 buf.
fGid = sbuf.st_gid;
339 buf.
fSize = sbuf.st_size;
340 buf.
fMtime = sbuf.st_mtime;
365 Info(
"AlienFilestat",
"Assuming an AliEn URL alien://%s",file);
368 return gapi_chmod(url.
GetUrl(),mode);
412 Error(
"TAlienSystem",
"You are not connected to AliEn");
423 Info(
"AccessPathName",
"Assuming an AliEn URL alien://%s",path);
426 if(!gapi_access(url.
GetUrl(),mode)) {
char fWorkingDirectory[1024]
ClassImp(TAlienSystem) TAlienSystem
Create a new OS interface.
virtual UserGroup_t * GetGroupInfo(Int_t gid)
Returns all group info in the UserGroup_t structure.
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
This class represents a WWW compatible URL.
virtual int Utime(const char *file, Long_t modtime, Long_t actime)
Set the a files modification and access times.
const char * GetProtocol() const
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static const char * filename()
virtual Int_t GetEffectiveGid()
Returns the effective group id.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual int Umask(Int_t mask)
Set the process file creation mode mask.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
Bool_t R_ISREG(Int_t mode)
virtual int AlienFilestat(const char *fpath, FileStat_t &buf)
Get info about a file.
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
virtual int Rename(const char *from, const char *to)
Rename a file.
if(pyself &&pyself!=Py_None)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual Bool_t Init()
Initialize the OS interface.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
const char * GetGrid() const
virtual Int_t GetEffectiveUid()
Returns the effective user id.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Int_t GetGid(const char *group=0)
Returns the group's id. If group = 0, returns current user's group.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract...
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual Int_t GetUid(const char *user=0)
Returns the user's id. If user = 0, returns current user's id.
virtual const char * GetHomeDirectory()
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
TString & Remove(Ssiz_t pos)
virtual int Link(const char *from, const char *to)
Create a link from file1 to file2.
virtual int Chmod(const char *file, UInt_t mode)
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
virtual ~TAlienSystem()
Delete the OS interface.
Bool_t R_ISDIR(Int_t mode)
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int MakeDirectory(const char *name)
Make a directory.
Abstract base class defining a generic interface to the underlying Operating System.
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: fs type, block size, number of blocks, number of free blocks...
void CleanRelativePath()
Recompute the path removing all relative directory jumps via '..'.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual const char * WorkingDirectory()
Return working directory.