simplified last example
This commit is contained in:
parent
294c7f8198
commit
e4f555a0ca
1 changed files with 2 additions and 5 deletions
7
main.cpp
7
main.cpp
|
|
@ -94,15 +94,12 @@ int main() {
|
||||||
filename+=path;
|
filename+=path;
|
||||||
ifstream ifs;
|
ifstream ifs;
|
||||||
//A simple platform-independent file-or-directory check do not exist, but this works in most of the cases:
|
//A simple platform-independent file-or-directory check do not exist, but this works in most of the cases:
|
||||||
if(filename.find('.')!=string::npos) {
|
if(filename.find('.')==string::npos) {
|
||||||
ifs.open(filename, ifstream::in);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(filename[filename.length()-1]!='/')
|
if(filename[filename.length()-1]!='/')
|
||||||
filename+='/';
|
filename+='/';
|
||||||
filename+="index.html";
|
filename+="index.html";
|
||||||
ifs.open(filename, ifstream::in);
|
|
||||||
}
|
}
|
||||||
|
ifs.open(filename, ifstream::in);
|
||||||
|
|
||||||
if(ifs) {
|
if(ifs) {
|
||||||
ifs.seekg(0, ios::end);
|
ifs.seekg(0, ios::end);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue