Skip to content

Commit 33018b1

Browse files
committed
make File::name() const
1 parent 0a22771 commit 33018b1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/AudioLibs/Desktop/File.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class File : public Stream {
2121
File(const char* fn) {
2222
open(fn, FILE_READ);
2323
}
24-
25-
File(File &file){
24+
File(const File &file){
2625
open(file.name(), FILE_READ);
2726
}
2827

@@ -31,7 +30,6 @@ class File : public Stream {
3130
return *this;
3231
}
3332

34-
3533
void open(const char* name, FileMode mode){
3634
file_path = name;
3735
switch(mode){
@@ -171,7 +169,7 @@ class File : public Stream {
171169
stream.close();
172170
}
173171

174-
const char* name() {
172+
const char* name() const {
175173
return file_path;
176174
}
177175

@@ -193,8 +191,9 @@ class FS {
193191
file.open(path, mode);
194192
return file;
195193
}
196-
File open(const std::string& path, FileMode mode = FILE_READ){
197-
return open(path.c_str(), mode);
194+
File open(const std::string &path, FileMode mode = FILE_READ){
195+
const char* path_str = path.c_str();
196+
return this->open(path_str, mode);
198197
}
199198
bool exists(const char* path){
200199
struct stat buffer;

0 commit comments

Comments
 (0)