-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read the target name from Makefile and set it in settings
- Loading branch information
1 parent
b8d5526
commit ac64c31
Showing
4 changed files
with
96 additions
and
2 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
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,60 @@ | ||
/* | ||
* Copyright 2024, the Genio team | ||
* All rights reserved. Distributed under the terms of the MIT license. | ||
*/ | ||
|
||
// TODO: Very basic, it only reads the "NAME" from haiku makefiles. | ||
// Should implement a real makefile reader | ||
|
||
#include "MakeFileHandler.h" | ||
|
||
#include <fstream> | ||
#include <iostream> | ||
|
||
|
||
MakeFileHandler::MakeFileHandler() | ||
{ | ||
} | ||
|
||
|
||
MakeFileHandler::MakeFileHandler(const char* path) | ||
{ | ||
SetTo(path); | ||
} | ||
|
||
|
||
MakeFileHandler::~MakeFileHandler() | ||
{ | ||
} | ||
|
||
|
||
status_t | ||
MakeFileHandler::SetTo(const char* path) | ||
{ | ||
std::ifstream inFile(path); | ||
std::string line; | ||
while (std::getline(inFile, line)) { | ||
if (line.starts_with("NAME")) { | ||
size_t pos = line.find("="); | ||
if (pos != std::string::npos) { | ||
fTargetName = line.substr(pos + 1).c_str(); | ||
break; | ||
} | ||
} | ||
} | ||
return B_OK; | ||
} | ||
|
||
|
||
void | ||
MakeFileHandler::GetTargetName(BString& outName) const | ||
{ | ||
outName = fTargetName; | ||
} | ||
|
||
|
||
void | ||
MakeFileHandler::SetTargetName(const BString& inName) | ||
{ | ||
fTargetName = inName; | ||
} |
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,22 @@ | ||
/* | ||
* Copyright 2024, the Genio team | ||
* All rights reserved. Distributed under the terms of the MIT license. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <String.h> | ||
|
||
class MakeFileHandler { | ||
public: | ||
MakeFileHandler(); | ||
MakeFileHandler(const char* path); | ||
virtual ~MakeFileHandler(); | ||
|
||
status_t SetTo(const char* path); | ||
|
||
void GetTargetName(BString &docText) const; | ||
void SetTargetName(const BString& docText); | ||
private: | ||
BString fTargetName; | ||
}; |
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