ConvertToFS() public static method

Converts all flag files in a directory into real filesystem attributes (executable bits and symlinks).
public static ConvertToFS ( [ path ) : void
path [ The path to the directory to convert.
return void
Example #1
0
        protected virtual string VerifyAndAdd(string tempID, ManifestDigest expectedDigest, ITaskHandler handler)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(tempID))
            {
                throw new ArgumentNullException(nameof(tempID));
            }
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            #endregion

            // Determine the digest method to use
            string?expectedDigestValue = expectedDigest.Best;
            if (string.IsNullOrEmpty(expectedDigestValue))
            {
                throw new NotSupportedException(Resources.NoKnownDigestMethod);
            }

            // Determine the source and target directories
            string source = Path.Combine(DirectoryPath, tempID);
            string target = Path.Combine(DirectoryPath, expectedDigestValue);

            if (_isUnixFS)
            {
                FlagUtils.ConvertToFS(source);
            }

            // Calculate the actual digest, compare it with the expected one and create a manifest file
            VerifyDirectory(source, expectedDigest, handler).Save(Path.Combine(source, Manifest.ManifestFile));

            lock (_renameLock) // Prevent race-conditions when adding the same digest twice
            {
                if (Directory.Exists(target))
                {
                    throw new ImplementationAlreadyInStoreException(expectedDigest);
                }

                // Move directory to final store destination
                try
                {
                    Directory.Move(source, target);
                }
                catch (IOException ex)
                    // TODO: Make language independent
                    when(ex.Message.Contains("already exists"))
                    {
                        throw new ImplementationAlreadyInStoreException(expectedDigest);
                    }
            }

            // Prevent any further changes to the directory
            if (_useWriteProtection)
            {
                EnableWriteProtection(target);
            }
            return(target);
        }