mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Constified some Filesystem module methods
This commit is contained in:
@@ -174,12 +174,12 @@ bool Filesystem::setupWriteDirectory()
|
||||
return true;
|
||||
}
|
||||
|
||||
File *Filesystem::newFile(const char *filename)
|
||||
File *Filesystem::newFile(const char *filename) const
|
||||
{
|
||||
return new File(filename);
|
||||
}
|
||||
|
||||
FileData *Filesystem::newFileData(void *data, unsigned int size, const char *filename)
|
||||
FileData *Filesystem::newFileData(void *data, unsigned int size, const char *filename) const
|
||||
{
|
||||
FileData *fd = new FileData(size, std::string(filename));
|
||||
|
||||
@@ -189,7 +189,7 @@ FileData *Filesystem::newFileData(void *data, unsigned int size, const char *fil
|
||||
return fd;
|
||||
}
|
||||
|
||||
FileData *Filesystem::newFileData(const char *b64, const char *filename)
|
||||
FileData *Filesystem::newFileData(const char *b64, const char *filename) const
|
||||
{
|
||||
int size = strlen(b64);
|
||||
int outsize = 0;
|
||||
@@ -270,21 +270,21 @@ const char *Filesystem::getSaveDirectory()
|
||||
return save_path_full.c_str();
|
||||
}
|
||||
|
||||
bool Filesystem::exists(const char *file)
|
||||
bool Filesystem::exists(const char *file) const
|
||||
{
|
||||
if (PHYSFS_exists(file))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Filesystem::isDirectory(const char *file)
|
||||
bool Filesystem::isDirectory(const char *file) const
|
||||
{
|
||||
if (PHYSFS_isDirectory(file))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Filesystem::isFile(const char *file)
|
||||
bool Filesystem::isFile(const char *file) const
|
||||
{
|
||||
return exists(file) && !isDirectory(file);
|
||||
}
|
||||
@@ -523,7 +523,7 @@ int Filesystem::getLastModified(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int64 Filesystem::getSize(const char *filename)
|
||||
int64 Filesystem::getSize(const char *filename) const
|
||||
{
|
||||
File file(filename);
|
||||
int64 size = file.getSize();
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
/**
|
||||
* Creates a new file.
|
||||
**/
|
||||
File *newFile(const char *filename);
|
||||
File *newFile(const char *filename) const;
|
||||
|
||||
/**
|
||||
* Creates a new FileData object. Data will be copied.
|
||||
@@ -155,13 +155,13 @@ public:
|
||||
* @param size The size of the data.
|
||||
* @param filename The full filename used to file type identification.
|
||||
**/
|
||||
FileData *newFileData(void *data, unsigned int size, const char *filename);
|
||||
FileData *newFileData(void *data, unsigned int size, const char *filename) const;
|
||||
|
||||
/**
|
||||
* Creates a new FileData object from base64 data.
|
||||
* @param b64 The base64 data.
|
||||
**/
|
||||
FileData *newFileData(const char *b64, const char *filename);
|
||||
FileData *newFileData(const char *b64, const char *filename) const;
|
||||
|
||||
/**
|
||||
* Gets the current working directory.
|
||||
@@ -190,20 +190,20 @@ public:
|
||||
* or not.
|
||||
* @param file The filename to check.
|
||||
**/
|
||||
bool exists(const char *file);
|
||||
bool exists(const char *file) const;
|
||||
|
||||
/**
|
||||
* Checks if an existing file really is a directory.
|
||||
* @param file The filename to check.
|
||||
**/
|
||||
bool isDirectory(const char *file);
|
||||
bool isDirectory(const char *file) const;
|
||||
|
||||
/**
|
||||
* Checks if an existing file really is a file,
|
||||
* and not a directory.
|
||||
* @param file The filename to check.
|
||||
**/
|
||||
bool isFile(const char *file);
|
||||
bool isFile(const char *file) const;
|
||||
|
||||
/**
|
||||
* Creates a directory. Write dir must be set.
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
* Gets the size of a file in bytes.
|
||||
* @param filename The name of the file.
|
||||
**/
|
||||
int64 getSize(const char *filename);
|
||||
int64 getSize(const char *filename) const;
|
||||
|
||||
/**
|
||||
* Text file line-reading iterator function used and
|
||||
|
||||
Reference in New Issue
Block a user