You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
1.0 KiB

using System;
using System.Collections.Generic;
using System.Text;
namespace DockerFileBuildHelper
{
public class DockerFile
{
public string DockerFileName { get; private set; }
public string DockerDirectoryPath { get; private set; }
public string DockerFullPath
{
get
{
if (DockerDirectoryPath == ".")
return $"{DockerFileName}";
else
return $"{DockerDirectoryPath}/{DockerFileName}";
}
}
public static DockerFile Parse(string str)
{
var file = new DockerFile();
var lastPart = str.LastIndexOf('/');
file.DockerFileName = str.Substring(lastPart + 1);
if (lastPart == -1)
{
file.DockerDirectoryPath = ".";
}
else
{
file.DockerDirectoryPath = str.Substring(0, lastPart);
}
return file;
}
}
}