Browse Source

Fix #1 - just use QFileInfo.

nemerle 9 years ago
parent
commit
bc5784a8f2
1 changed files with 3 additions and 12 deletions
  1. 3 12
      src/project.cpp

+ 3 - 12
src/project.cpp

@@ -25,19 +25,10 @@ void Project::initialize()
 void Project::create(const QString &a)
 {
     initialize();
+    QFileInfo fi(a);
     m_fname=a;
-    auto ext_loc=a.lastIndexOf('.');
-    auto slash_loc=a.lastIndexOf('/',ext_loc);
-    if(slash_loc==-1)
-        slash_loc=0;
-    else
-        slash_loc++;
-    if(ext_loc!=-1) {
-        m_project_name = a.mid(slash_loc,ext_loc-slash_loc);
-    }
-    else
-        m_project_name = a.mid(slash_loc);
-    m_output_path = a.left(slash_loc);
+    m_project_name = fi.completeBaseName();
+    m_output_path = fi.path();
 }
 
 QString Project::output_name(const char *ext) {