rabin 15 hours ago
parent
commit
906427a60f
1 changed files with 15 additions and 12 deletions
  1. 15 12
      src/Dever/Project.php

+ 15 - 12
src/Dever/Project.php

@@ -21,6 +21,7 @@ class Project
         $file = self::init();
         if (empty(self::$content[DEVER_APP_NAME])) {
             $host = DEVER_APP_HOST;
+            $path = explode('_', DEVER_APP_NAME);
             if (strpos($host, '/src/' . DEVER_APP_NAME)) {
                 $host = explode('/src/' . DEVER_APP_NAME, $host)[0] . '/';
             } elseif (strpos($host, '/app/' . DEVER_APP_NAME)) {
@@ -28,8 +29,12 @@ class Project
             }elseif (strpos($host, '/package/' . DEVER_APP_NAME)) {
                 $host = explode('/package/' . DEVER_APP_NAME, $host)[0] . '/';
             }
-            self::write($host, 'package');self::write($host, 'src');self::write($host, 'app');
+            self::write($host, 'package');
+            //self::write($host, 'package');self::write($host, 'src');self::write($host, 'app');
             self::$content[DEVER_APP_NAME]['url'] = DEVER_APP_HOST;
+            if (empty(self::$content[DEVER_APP_NAME]['path'])) {
+                self::$content[DEVER_APP_NAME]['path'] = DEVER_APP_PATH;
+            }
             if (isset(self::$content['manage'])) {
                 $manage = self::$content['manage'];
                 unset(self::$content['manage']);
@@ -44,6 +49,7 @@ class Project
             self::$content[DEVER_APP_NAME]['lang'] = DEVER_APP_LANG;
             self::content($file);
         }
+
     }
     public static function write($host, $name)
     {
@@ -52,20 +58,17 @@ class Project
             $data = scandir($dir);
             foreach ($data as $v) {
                 if (empty(self::$content[$v]) && is_dir($dir . '/' . $v) && $v !== '.' && $v !== '..') {
-                    if (is_file($dir . $v . '/index.php')) {
-                        $k = $name . '/' . $v . '/';
+                    $p = $v;
+                    $k = $name . '/' . $v . '/';
+                    if ($v == 'manage') {
+                        $p = 'manage/api';
+                    }
+                    if (is_file($dir . $p . '/index.php')) {
                         self::$content[$v] = array();
                         if (strstr($name, 'package')) {
-                            if (strstr($name, 'package/manage')) {
-                                unset(self::$content[$v]);
-                                $v = 'manage';
-                                self::$content[$v] = array();
-                                self::$content[$v]['path'] = DEVER_PATH . $name . '/';
-                            } elseif($v == 'manage') {
-                                self::$content[$v]['path'] = DEVER_PATH . $k;
+                            self::$content[$v]['path'] = DEVER_PATH . $k;
+                            if ($v == 'manage') {
                                 $k .= 'api/';
-                            } else {
-                                self::$content[$v]['path'] = DEVER_PATH . $k;
                             }
                             self::$content[$v]['setup'] = DEVER_PROJECT_PATH . $k;
                         } else {