예제 #1
0
        /// <summary>
        /// Initializes the cache with the given (relative) vcsRoot.
        /// </summary>
        /// <param name="versionSystem">The version system to attach cache to</param>
        /// <exception cref="IOException">If the cache could not be found and the creation of the directory failed.</exception>
        public Cache(VersionControlSystem versionSystem)
        {
            _versionSystem = versionSystem;

            if (!_versionSystem.IsDirectory(FileSystem.CACHE_DIR))
            {
                _versionSystem.CreateDirectory(FileSystem.CACHE_DIR);
            }
        }
예제 #2
0
        //private static readonly Object StateLock = new object();
        /// <summary>
        /// Initializes the repository by searching for the vcsRoot of the file system in the configuration and initializing
        /// a FileSystemAdaptee, Cache and Config to keep track of the files under the repository structure.
        /// </summary>
        /// <exception cref="KeyNotFoundException">If the root directory could not be found</exception>
        private Repository()
        {
            // Read the config
            Config = Config.GetInstance();

            String root = Config["rootDirectory"];

            // Init file system
            FileSystem = new PieFileSystem(new FileSystem(root), this);

            // Create .pie folder if it does not exist
            if (!FileSystem.Exists(InputOutputLayer.FileSystem.META_DIR))
            {
                FileSystem.CreateDirectory(InputOutputLayer.FileSystem.META_DIR);
            }

            // Verify cache
            var vcs = new VersionControlSystem("", FileSystem);
            var cache = new Cache(vcs);
            cache.Verify();
        }