예제 #1
0
 public static OptionalSdkConfigOptions Optionalize(this Optional <SdkConfigOptions> sdkConfigOptions)
 {
     if (sdkConfigOptions.HasValue)
     {
         var someConfig = sdkConfigOptions.Value;
         return(new OptionalSdkConfigOptions(
                    androidSdkDirectory: AbsoluteDirectoryPath.TryParse(someConfig.AndroidSdkDirectory),
                    androidNdkDirectory: AbsoluteDirectoryPath.TryParse(someConfig.AndroidNdkDirectory),
                    javaJdkDirectory: AbsoluteDirectoryPath.TryParse(someConfig.JavaJdkDirectory),
                    androidSdkBuildToolsVersion: someConfig.AndroidSdkBuildToolsVersion.ToOptional(),
                    cmake: AbsoluteDirectoryPath.TryParse(someConfig.CMake),
                    haveAllSdkPackages: someConfig.HaveAllSdkPackages
                    ));
     }
     else
     {
         return(new OptionalSdkConfigOptions(
                    Optional.None(),
                    Optional.None(),
                    Optional.None(),
                    Optional.None(),
                    Optional.None(),
                    false));
     }
 }
예제 #2
0
        public static IValidationResult <AbsoluteDirectoryPath> ValidateExistingDirectory(string nativePath)
        {
            var parsed = AbsoluteDirectoryPath.TryParse(nativePath);

            if (parsed.HasValue && !Directory.Exists(nativePath))
            {
                return(Optional.None <AbsoluteDirectoryPath>().AsValidationResult("No such directory"));
            }
            return(parsed.AsValidationResult("Invalid path"));
        }
예제 #3
0
        static AbsoluteFilePath FindMonoExe(AbsoluteDirectoryPath fuseRoot)
        {
            var monoRoot = File.ReadAllText((fuseRoot / new FileName(".mono_root")).NativePath);
            var monoPath = RelativeDirectoryPath.TryParse(monoRoot)
                           .Select(monoRelative => fuseRoot / monoRelative)
                           .Or(AbsoluteDirectoryPath.TryParse(monoRoot))
                           .OrThrow(new InvalidPath(monoRoot, new Exception("Invalid mono root path.")));

            return(monoPath / new DirectoryName("bin") / new FileName("mono"));
        }
예제 #4
0
 public static ProjectSnapshot CreateSnapshot(Project project, AbsoluteDirectoryPath root)
 {
     project.InvalidateItems();
     return(new ProjectSnapshot(
                name: project.Name,
                uxFiles:
                project.UXFiles
                .Select(f => root / RelativeFilePath.Parse(f.UnixPath))
                .ToImmutableHashSet(),
                bundleFiles:
                project.BundleFiles
                .Select(f => root / RelativeFilePath.Parse(f.UnixPath))
                .ToImmutableHashSet(),
                fuseJsFiles:
                project.FuseJSFiles
                .Select(f => root / RelativeFilePath.Parse(f.UnixPath))
                .ToImmutableHashSet(),
                buildOutputDirectory:
                AbsoluteDirectoryPath.TryParse(project.BuildDirectory).Or(root / new DirectoryName("build")),
                packageReferences: project.PackageReferences.ToImmutableHashSet(),
                projectReferences: project.ProjectReferences.ToImmutableHashSet()
                ));
 }
예제 #5
0
 public DialogPathResult(string rawPath)
 {
     _rawPath = rawPath;
     Path     = AbsoluteDirectoryPath.TryParse(rawPath).Select(p => (IAbsolutePath)p)
                .Or(AbsoluteFilePath.TryParse(rawPath).Select(p => (IAbsolutePath)p));
 }