2019-09-04 22:29:23 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Capnpc.Csharp.MsBuild.Generation
|
|
|
|
|
{
|
|
|
|
|
public class FilePathGenerator
|
|
|
|
|
{
|
2019-09-05 21:59:25 +02:00
|
|
|
|
public string GenerateFilePath(string projectFolder, string capnpFileName, string generatedCodeBehindFileName)
|
2019-09-04 22:29:23 +02:00
|
|
|
|
{
|
|
|
|
|
if (projectFolder is null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(projectFolder));
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-05 21:59:25 +02:00
|
|
|
|
if (capnpFileName is null)
|
2019-09-04 22:29:23 +02:00
|
|
|
|
{
|
2019-09-05 21:59:25 +02:00
|
|
|
|
throw new ArgumentNullException(nameof(capnpFileName));
|
2019-09-04 22:29:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (generatedCodeBehindFileName is null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(generatedCodeBehindFileName));
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-05 21:59:25 +02:00
|
|
|
|
string featureFileFullPath = Path.GetFullPath(Path.Combine(projectFolder, capnpFileName));
|
2019-09-04 22:29:23 +02:00
|
|
|
|
string featureFileDirPath = Path.GetDirectoryName(featureFileFullPath);
|
|
|
|
|
|
|
|
|
|
return Path.Combine(featureFileDirPath, generatedCodeBehindFileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|