@@ -40,7 +40,7 @@ func cleanPath(paths []string, fullPath bool) []string {
4040 return processedPaths
4141}
4242
43- func GetNewPaths (paths []string , fullPath bool ) []string {
43+ func GetNewPaths (paths []string , fullPath bool , rootPath string ) []string {
4444 paths = cleanPath (paths , fullPath )
4545 var path = env .GetModulesDir ()
4646
@@ -52,28 +52,28 @@ func GetNewPaths(paths []string, fullPath bool) []string {
5252 if _ , err := os .Stat (packagePath ); ! os .IsNotExist (err ) {
5353
5454 other , _ := models .LoadPackageOther (packagePath )
55- paths = getNewPathsFromDir (filepath .Join (path , value .Name (), other .MainSrc ), paths , fullPath )
55+ paths = getNewPathsFromDir (filepath .Join (path , value .Name (), other .MainSrc ), paths , fullPath , rootPath )
5656
5757 } else {
58- paths = getNewPathsFromDir (filepath .Join (path , value .Name ()), paths , fullPath )
58+ paths = getNewPathsFromDir (filepath .Join (path , value .Name ()), paths , fullPath , rootPath )
5959 }
6060 }
6161 return paths
6262}
6363
64- func getDefaultPath (fullPath bool ) []string {
64+ func getDefaultPath (fullPath bool , rootPath string ) []string {
6565 var paths []string
6666
6767 if ! fullPath {
6868 fullPath := filepath .Join (env .GetCurrentDir (), consts .FolderDependencies , consts .DcpFolder )
6969
70- dir , err := filepath .Rel (env . GetCurrentDir () , fullPath )
70+ dir , err := filepath .Rel (rootPath , fullPath )
7171 if err == nil {
7272 paths = append (paths , dir )
7373 }
7474
7575 fullPath = filepath .Join (env .GetCurrentDir (), consts .FolderDependencies , consts .DcuFolder )
76- dir , err = filepath .Rel (env . GetCurrentDir () , fullPath )
76+ dir , err = filepath .Rel (rootPath , fullPath )
7777 if err == nil {
7878 paths = append (paths , dir )
7979 }
@@ -99,7 +99,7 @@ func cleanEmpty(paths []string) []string {
9999 return paths
100100}
101101
102- func getNewPathsFromDir (path string , paths []string , fullPath bool ) []string {
102+ func getNewPathsFromDir (path string , paths []string , fullPath bool , rootPath string ) []string {
103103 _ , e := os .Stat (path )
104104 if os .IsNotExist (e ) {
105105 return paths
@@ -110,7 +110,7 @@ func getNewPathsFromDir(path string, paths []string, fullPath bool) []string {
110110 if matched {
111111 dir , _ := filepath .Split (path )
112112 if ! fullPath {
113- dir , _ = filepath .Rel (env . GetCurrentDir () , dir )
113+ dir , _ = filepath .Rel (rootPath , dir )
114114 }
115115 if ! utils .Contains (paths , dir ) {
116116 paths = append (paths , dir )
@@ -119,7 +119,7 @@ func getNewPathsFromDir(path string, paths []string, fullPath bool) []string {
119119 return nil
120120 })
121121
122- for _ , path := range getDefaultPath (fullPath ) {
122+ for _ , path := range getDefaultPath (fullPath , rootPath ) {
123123 if ! utils .Contains (paths , path ) {
124124 paths = append (paths , path )
125125 }
0 commit comments