From 302af1e1a246581eb8130b0d9cc90b8875a4a8b9 Mon Sep 17 00:00:00 2001 From: Rob1103 Date: Wed, 19 Apr 2023 09:57:13 +0200 Subject: [PATCH] include directive paths problem fix 3 --- srcs/buildtool/unikraft_files_process.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/srcs/buildtool/unikraft_files_process.go b/srcs/buildtool/unikraft_files_process.go index 84f4fc1..ffb5756 100644 --- a/srcs/buildtool/unikraft_files_process.go +++ b/srcs/buildtool/unikraft_files_process.go @@ -195,15 +195,10 @@ func conformIncDirAndCopyFile(sourcePath, destPath string) (err error) { for index := range fileLines { for _, match := range re.FindAllStringSubmatch(fileLines[index], -1) { - // Only interested in user-defined directives containing a path to a header file - if !strings.Contains(match[0], "/") { - continue - } - // Replace the path by its last element for i := 1; i < len(match); i++ { if match[i] == "\"" { - match[i+1] = filepath.Base(match[i+1]) + match[i+1] = "include/" + filepath.Base(match[i+1]) fileLines[index] = strings.Join(match[1:], "") + "\n" break } @@ -244,7 +239,7 @@ func processSourceFiles(sourcesPath, appFolder, includeFolder string, includesFiles = append(includesFiles, info.Name()) // Copy header files to the INCLUDEFOLDER - if err = conformIncDirAndCopyFile(path, includeFolder+info.Name()); err != nil { + if err = u.CopyFileContents(path, includeFolder+info.Name()); err != nil { return err } } else {