/usr/include/IceUtil/FileUtil.h is in libzeroc-ice-dev 3.7.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | // **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_FILE_UTIL_H
#define ICE_FILE_UTIL_H
#include <IceUtil/Config.h>
#include <IceUtil/Shared.h>
#include <IceUtil/Handle.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
namespace IceUtilInternal
{
extern const ICE_API std::string pathsep;
extern const ICE_API std::string separator;
//
// Detemine if path is an absolute path.
//
ICE_API bool isAbsolutePath(const std::string&);
//
// Determine if a file exists.
//
ICE_API bool fileExists(const std::string&);
//
// Determine if a directory exists.
//
ICE_API bool directoryExists(const std::string&);
//
// Determine if a directory exists and is empty.
//
ICE_API bool isEmptyDirectory(const std::string&);
#ifdef _WIN32
#if defined(__MINGW32__)
typedef struct _stat structstat;
#else
typedef struct _stat64i32 structstat;
#endif
#ifdef _MSC_VER
#ifndef O_RDONLY
# define O_RDONLY _O_RDONLY
#endif
#ifndef O_BINARY
# define O_BINARY _O_BINARY
#endif
#ifndef S_ISDIR
# define S_ISDIR(mode) ((mode) & _S_IFDIR)
#endif
#ifndef S_ISREG
# define S_ISREG(mode) ((mode) & _S_IFREG)
#endif
#endif
#else
typedef struct stat structstat;
# define O_BINARY 0
#endif
//
// OS stat
//
ICE_API int stat(const std::string&, structstat*);
ICE_API int remove(const std::string&);
ICE_API int rename(const std::string&, const std::string&);
ICE_API int rmdir(const std::string&);
ICE_API int mkdir(const std::string&, int);
ICE_API FILE* fopen(const std::string&, const std::string&);
ICE_API FILE* freopen(const std::string&, const std::string&, FILE*);
ICE_API int open(const std::string&, int);
#ifndef ICE_OS_UWP
ICE_API int getcwd(std::string&);
#endif
ICE_API int unlink(const std::string&);
ICE_API int close(int);
//
// This class is used to implement process file locking. This class
// is not intended to do file locking within the same process.
//
class ICE_API FileLock : public IceUtil::Shared, public IceUtil::noncopyable
{
public:
//
// The constructor opens the given file (eventually creating it)
// and acquires a lock on the file or throws FileLockException if
// the file couldn't be locked.
//
// If the lock can be acquired, the process pid is written to the
// file.
//
FileLock(const std::string&);
//
// The destructor releases the lock and removes the file.
//
virtual ~FileLock();
private:
#ifdef _WIN32
HANDLE _fd;
#else
int _fd;
#endif
std::string _path;
};
typedef IceUtil::Handle<FileLock> FileLockPtr;
//
// Use streamFilename to construct the filename given to std stream classes
// like ifstream and ofstream.
//
#if defined(_WIN32) && !defined(__MINGW32__)
ICE_API std::wstring streamFilename(const std::string&);
#else
inline std::string streamFilename(const std::string& filename)
{
return filename;
}
#endif
}
#endif
|