mirror of
https://github.com/Squibid/rph.git
synced 2025-10-19 19:34:04 +00:00
feat(template): make sure to generate the example.txt in the deploy dir
This should've been part of the template archive but WPILIB devs being WPILIB devs they can't build anything that doesn't take 5+ days to wrap your head around. Not to mention their complete lack of any good documentation.
This commit is contained in:
@@ -140,4 +140,35 @@ func GenerateProject(opts TemplateOptions) {
|
||||
|
||||
PostGradle:
|
||||
}
|
||||
|
||||
// Generate example deploy file
|
||||
{
|
||||
deployPath := filepath.Join(opts.Dir, "src", "main", "deploy")
|
||||
err := os.Mkdir(deployPath, 0755)
|
||||
if err != nil {
|
||||
slog.Error("Failed to make deploy directory", "error", err)
|
||||
goto PostExampleDeploy
|
||||
}
|
||||
|
||||
{ // Scope it so we can jump over it
|
||||
var exampleTxt string
|
||||
switch (opts.Lang) {
|
||||
case "cpp":
|
||||
exampleTxt = `Files placed in this directory will be deployed to the RoboRIO into the
|
||||
'deploy' directory in the home folder. Use the 'frc::filesystem::GetDeployDirectory'
|
||||
function from the 'frc/Filesystem.h' header to get a proper path relative to the deploy
|
||||
directory.`
|
||||
case "java":
|
||||
exampleTxt = `Files placed in this directory will be deployed to the RoboRIO into the
|
||||
'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function
|
||||
to get a proper path relative to the deploy directory.`
|
||||
default:
|
||||
exampleTxt = `Files placed in this directory will be deployed to the RoboRIO into the
|
||||
'deploy' directory in the home folder.`
|
||||
}
|
||||
|
||||
os.WriteFile(deployPath, []byte(exampleTxt), 0644)
|
||||
}
|
||||
PostExampleDeploy:
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user