예제 #1
0
        /// <summary>
        /// This method takes the information in a file description and
        /// converts it to a full path specification - with wildcards.
        /// </summary>
        /// <remarks>
        /// Using the wildcard-to-regex library found at
        /// http://www.codeproject.com/KB/string/wildcmp.aspx on the
        /// output of this method might be very helpful.
        /// </remarks>
        /// <param name="file">Object describing a component's file.</param>
        /// <returns>
        /// Returns a full path, potentially including DOS wildcards.  Eg.
        /// 'c:\windows\config\*'.
        /// </returns>
        string FileToPathSpecification(VssWMFileDescription file)
        {
            // Environment variables (eg. "%windir%") are common.
            string path = Environment.ExpandEnvironmentVariables(file.Path);

            // Use the alternate location if it's present.
            if (!String.IsNullOrEmpty(file.AlternateLocation))
            {
                path = Environment.ExpandEnvironmentVariables(
                    file.AlternateLocation);
            }

            // Normalize wildcard usage.
            string spec = file.FileSpecification.Replace("*.*", "*");

            // Combine the file specification and the directory name.
            return(Path.Combine(path, file.FileSpecification));
        }
예제 #2
0
      /// <summary>
      /// This method takes the information in a file description and
      /// converts it to a full path specification - with wildcards.
      /// </summary>
      /// <remarks>
      /// Using the wildcard-to-regex library found at
      /// http://www.codeproject.com/KB/string/wildcmp.aspx on the
      /// output of this method might be very helpful.
      /// </remarks>
      /// <param name="file">Object describing a component's file.</param>
      /// <returns>
      /// Returns a full path, potentially including DOS wildcards.  Eg.
      /// 'c:\windows\config\*'.
      /// </returns>
      string FileToPathSpecification(VssWMFileDescription file)
      {
         // Environment variables (eg. "%windir%") are common.
         string path = Environment.ExpandEnvironmentVariables(file.Path);

         // Use the alternate location if it's present.
         if (!String.IsNullOrEmpty(file.AlternateLocation))
            path = Environment.ExpandEnvironmentVariables(
                  file.AlternateLocation);

         // Normalize wildcard usage.
         string spec = file.FileSpecification.Replace("*.*", "*");

         // Combine the file specification and the directory name.
         return Path.Combine(path, file.FileSpecification);
      }