Skip to content

Commit 1b38baf

Browse files
WIP
1 parent da4a0aa commit 1b38baf

File tree

5 files changed

+57
-8
lines changed

5 files changed

+57
-8
lines changed

Include/runcpp2/ParseUtil.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ namespace Internal
2424

2525
bool CheckNodeRequirements(YAML::Node& node, const std::vector<NodeRequirement>& requirements);
2626

27-
2827
bool GetParsableInfo(const std::string& contentToParse, std::string& outParsableInfo);
28+
29+
30+
2931
}
3032

3133
}

Include/runcpp2/PlatformUtil.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ namespace Internal
1616

1717
std::string ProcessPath(const std::string& path);
1818

19-
bool FileExists(const std::string& path, bool& outIsDir);
19+
bool FileOrDirectoryExists(const std::string& path, bool& outIsDir);
2020

2121
std::string GetFileDirectory(const std::string& filePath);
2222

23+
std::string GetFileNameWithExtension(const std::string& filePath);
24+
2325
std::string GetFileNameWithoutExtension(const std::string& filePath);
2426

27+
std::string GetFileExtension(const std::string& filePath);
28+
2529
std::vector<std::string> GetPlatformNames();
2630
}
2731

Include/runcpp2/ScriptInfo.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ namespace runcpp2
1919
FlagsOverrideInfo OverrideCompileFlags;
2020
FlagsOverrideInfo OverrideLinkFlags;
2121

22+
bool Populated = false;
23+
2224
bool ParseYAML_Node(YAML::Node& node);
2325
std::string ToString(std::string indentation) const;
2426
};

Include/runcpp2/runcpp2.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,26 @@ namespace runcpp2
2121

2222
bool ReadUserConfig(std::vector<CompilerProfile>& outProfiles);
2323

24+
bool GetScriptInfoString( const std::string& processedScriptPath,
25+
std::string& outScriptInfoString);
26+
2427
bool ParseScriptInfo( const std::string& scriptInfo,
2528
ScriptInfo& outScriptInfo);
2629

30+
bool CreateRuncpp2ScriptDirectory(const std::string& processedScriptPath);
31+
32+
bool SetupScriptDependencies( const std::string& processedScriptPath,
33+
const ScriptInfo& scriptInfo);
34+
35+
bool CopyDependencies( const std::string& processedScriptPath,
36+
const ScriptInfo& scriptInfo);
37+
38+
bool CompileAndLinkScript( const std::string& processedScriptPath,
39+
const ScriptInfo& scriptInfo,
40+
const std::vector<CompilerProfile>& profiles);
41+
42+
43+
2744
bool RunScript(const std::string& scriptPath, const std::vector<CompilerProfile>& profiles);
2845

2946

Src/runcpp2/PlatformUtil.cpp

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace Internal
6060
return path;
6161
}
6262

63-
bool FileExists(const std::string& path, bool& outIsDir)
63+
bool FileOrDirectoryExists(const std::string& path, bool& outIsDir)
6464
{
6565
tinydir_file inputFile;
6666

@@ -92,25 +92,49 @@ namespace Internal
9292
return scriptDirectory;
9393
}
9494

95-
std::string GetFileNameWithoutExtension(const std::string& filePath)
95+
std::string GetFileNameWithExtension(const std::string& filePath)
9696
{
9797
char separator = GetFileSystemSeparator();
9898

99-
std::size_t lastDotIndex = filePath.rfind(".");
10099
std::size_t lastSlashIndex = filePath.rfind(separator);
101100

102101
std::string filename;
102+
if(lastSlashIndex != std::string::npos)
103+
filename = filename.substr(lastSlashIndex + 1);
104+
105+
return filename;
106+
}
107+
108+
std::string GetFileNameWithoutExtension(const std::string& filePath)
109+
{
110+
std::string filename = GetFileNameWithExtension(filePath);
111+
112+
char separator = GetFileSystemSeparator();
113+
114+
std::size_t lastDotIndex = filePath.rfind(".");
115+
103116
if(lastDotIndex == std::string::npos)
104117
filename = filePath;
105118
else
106119
filename = filePath.substr(0, lastDotIndex);
107120

108-
if(lastSlashIndex != std::string::npos)
109-
filename = filename.substr(lastSlashIndex + 1);
110-
111121
return filename;
112122
}
113123

124+
std::string GetFileExtension(const std::string& filePath)
125+
{
126+
std::size_t lastDotIndex = filePath.rfind(".");
127+
std::string extension;
128+
129+
if(lastDotIndex == std::string::npos)
130+
extension = "";
131+
else
132+
extension = filePath.substr(lastDotIndex+1);
133+
134+
return extension;
135+
}
136+
137+
114138
std::vector<std::string> GetPlatformNames()
115139
{
116140
#ifdef _WIN32

0 commit comments

Comments
 (0)