cpp_input 生成在指定目录 appdata
This commit is contained in:
parent
bb39391149
commit
74698bdea2
@ -32,7 +32,7 @@ namespace refl
|
|||||||
[Option('h', "help", HelpText = "Display this help message.")]
|
[Option('h', "help", HelpText = "Display this help message.")]
|
||||||
public bool Help { get; set; } = false;
|
public bool Help { get; set; } = false;
|
||||||
|
|
||||||
static string InputFile = "cpp_input.h";
|
static string InputFile = "/cpp_input.h";
|
||||||
static CppParserOptions MakeParserOptions(CmdBuildOption opt)
|
static CppParserOptions MakeParserOptions(CmdBuildOption opt)
|
||||||
{
|
{
|
||||||
var parse = new CppParserOptions
|
var parse = new CppParserOptions
|
||||||
@ -64,8 +64,18 @@ namespace refl
|
|||||||
StringBuilder code = new StringBuilder();
|
StringBuilder code = new StringBuilder();
|
||||||
string fileContent = File.ReadAllText(file_path);
|
string fileContent = File.ReadAllText(file_path);
|
||||||
code.AppendLine(fileContent.Replace("#include", "//#include"));
|
code.AppendLine(fileContent.Replace("#include", "//#include"));
|
||||||
File.WriteAllText(InputFile, code.ToString());
|
// 获取 Roaming AppData 目录
|
||||||
return InputFile;
|
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
|
string myAppPath = Path.Combine(appDataPath, "zengine");
|
||||||
|
|
||||||
|
// 如果目录不存在,则创建它
|
||||||
|
if (!Directory.Exists(myAppPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(myAppPath);
|
||||||
|
}
|
||||||
|
string path = myAppPath + InputFile;
|
||||||
|
File.WriteAllText(path, code.ToString());
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
public static int CMD_CheckBuildOption(CmdBuildOption opt)
|
public static int CMD_CheckBuildOption(CmdBuildOption opt)
|
||||||
{
|
{
|
||||||
@ -108,10 +118,6 @@ namespace refl
|
|||||||
{
|
{
|
||||||
Console.WriteLine("gen success!");
|
Console.WriteLine("gen success!");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
File.Delete(InputFile);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user