include directive paths problem fix 5
This commit is contained in:
parent
4ef09a6b2b
commit
5664ad23ca
2 changed files with 13 additions and 11 deletions
|
@ -238,11 +238,12 @@ func RunBuildTool(homeDir string, data *u.Data) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Conform file include directives to the new unikernel folder organisation
|
||||||
if err := conformIncludeDirectives(appFolder); err != nil {
|
if err := conformIncludeDirectives(appFolder); err != nil {
|
||||||
u.PrintErr(err)
|
u.PrintErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move config files to Unikraft folder
|
// Move config files to the unikernel folder
|
||||||
addConfigFiles(*args.StringListArg[configArg], &selectedFiles, *includeFolder, appFolder)
|
addConfigFiles(*args.StringListArg[configArg], &selectedFiles, *includeFolder, appFolder)
|
||||||
|
|
||||||
// Match micro-libs
|
// Match micro-libs
|
||||||
|
|
|
@ -125,7 +125,7 @@ func handleCreationApp(appFolder string) string {
|
||||||
fmt.Println("Make your choice:\n1: Copy and overwrite files\n2: " +
|
fmt.Println("Make your choice:\n1: Copy and overwrite files\n2: " +
|
||||||
"Enter manually the name of the folder\n3: exit program")
|
"Enter manually the name of the folder\n3: exit program")
|
||||||
var input int
|
var input int
|
||||||
for true {
|
for {
|
||||||
fmt.Print("Please enter your choice (0 to exit): ")
|
fmt.Print("Please enter your choice (0 to exit): ")
|
||||||
if _, err := fmt.Scanf("%d", &input); err != nil {
|
if _, err := fmt.Scanf("%d", &input); err != nil {
|
||||||
u.PrintWarning("Choice must be numeric! Try again")
|
u.PrintWarning("Choice must be numeric! Try again")
|
||||||
|
@ -146,8 +146,6 @@ func handleCreationApp(appFolder string) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return appFolder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------MOVE FILES TO APP FOLDER----------------------------
|
// -------------------------MOVE FILES TO APP FOLDER----------------------------
|
||||||
|
@ -176,9 +174,16 @@ func filterSourcesFiles(sourceFiles []string) []string {
|
||||||
return filterSrcFiles
|
return filterSrcFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// conformIncludeDirectives conforms all the user-defined include directives of all C/C++ source
|
||||||
|
// files to the unikernel directory format so that all these directives are paths to header files
|
||||||
|
// located in the include folder of the unikernel directory.
|
||||||
|
//
|
||||||
|
// It returns an error if any, otherwise it returns nil.
|
||||||
func conformIncludeDirectives(sourcesPath string) error {
|
func conformIncludeDirectives(sourcesPath string) error {
|
||||||
|
|
||||||
err := filepath.Walk(sourcesPath, func(path string, info os.FileInfo,
|
err := filepath.Walk(sourcesPath, func(path string, info os.FileInfo,
|
||||||
err error) error {
|
err error) error {
|
||||||
|
|
||||||
if !info.IsDir() {
|
if !info.IsDir() {
|
||||||
extension := filepath.Ext(info.Name())
|
extension := filepath.Ext(info.Name())
|
||||||
if extension == ".h" || extension == ".hpp" || extension == ".hcc" {
|
if extension == ".h" || extension == ".hpp" || extension == ".hcc" {
|
||||||
|
@ -202,10 +207,9 @@ func conformIncludeDirectives(sourcesPath string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// conformFile conforms all the user-defined include directives from a C/C++ source file so that
|
// conformFile conforms all the user-defined include directives of a C/C++ source file to the
|
||||||
// none of these directives contains a path to a header file but the header file name only (i.e.,
|
// unikernel directory format so that all these directives are paths to header files located in the
|
||||||
// the last element of the path). It also copies the content of the source file in the same way as
|
// include folder.
|
||||||
// CopyFileContents.
|
|
||||||
//
|
//
|
||||||
// It returns an error if any, otherwise it returns nil.
|
// It returns an error if any, otherwise it returns nil.
|
||||||
func conformFile(path string, isHeader bool) (err error) {
|
func conformFile(path string, isHeader bool) (err error) {
|
||||||
|
@ -261,9 +265,6 @@ func processSourceFiles(sourcesPath, appFolder, includeFolder string,
|
||||||
srcLanguages[extension] += 1
|
srcLanguages[extension] += 1
|
||||||
|
|
||||||
// Copy source files to the appFolder
|
// Copy source files to the appFolder
|
||||||
//if err = conformIncDirAndCopyFile(path, appFolder+info.Name()); err != nil {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
if err = u.CopyFileContents(path, appFolder+info.Name()); err != nil {
|
if err = u.CopyFileContents(path, appFolder+info.Name()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue