-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app.App: new type, reorganize work tree
- Loading branch information
1 parent
910b792
commit e0b67a4
Showing
4 changed files
with
41 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// SPDX-FileCopyrightText: 2024-2025 kurth4cker <[email protected]> | ||
|
||
package app | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os/exec" | ||
"path/filepath" | ||
"slices" | ||
) | ||
|
||
type App struct { | ||
Name string | ||
Sources []string | ||
} | ||
|
||
func (a *App) Build() { | ||
args := []string{"-o", a.Name} | ||
args = slices.Concat(args, a.Sources) | ||
|
||
cmd := exec.Command("cc", args...) | ||
cmd.Run() | ||
fmt.Println(cmd) | ||
} | ||
|
||
func (a *App) Scan(basedir string) { | ||
abs, err := filepath.Abs(basedir) | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
a.Name = filepath.Base(abs) | ||
|
||
a.Sources, _ = filepath.Glob(filepath.Join(basedir, "*.c")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// SPDX-FileCopyrightText: 2024-2025 kurth4cker <[email protected]> | ||
|
||
package app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// SPDX-FileCopyrightText: 2024 kurth4cker <[email protected]> | ||
// SPDX-FileCopyrightText: 2024-2025 kurth4cker <[email protected]> | ||
|
||
package main | ||
|
||
func main() { | ||
var project Project | ||
project.Initialize() | ||
project.Scan() | ||
|
||
project.Build() | ||
} |
This file was deleted.
Oops, something went wrong.