From e4f555a0ca3e763ca51d1b1882cc69c6c439bbc5 Mon Sep 17 00:00:00 2001 From: eidheim Date: Fri, 11 Jul 2014 13:20:49 +0200 Subject: [PATCH] simplified last example --- main.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 9218e55..8097d8c 100644 --- a/main.cpp +++ b/main.cpp @@ -94,15 +94,12 @@ int main() { filename+=path; ifstream ifs; //A simple platform-independent file-or-directory check do not exist, but this works in most of the cases: - if(filename.find('.')!=string::npos) { - ifs.open(filename, ifstream::in); - } - else { + if(filename.find('.')==string::npos) { if(filename[filename.length()-1]!='/') filename+='/'; filename+="index.html"; - ifs.open(filename, ifstream::in); } + ifs.open(filename, ifstream::in); if(ifs) { ifs.seekg(0, ios::end);