title: C# Client - Perl server - File Path Case Sensitivity
body: <p>We have a C# .Net client application that sends some commands via REST over HTTP.  The server is on a Linux machine written in Perl.</p>
  
  <p>These commands contain file paths located on the server that can be entered by the user.  Since the users are on windows, we'd like for them to be case-insensitive, but this is giving us some issues in locating the files server side.</p>
  
  <p>How can we get the correct casing?</p>
  
  <p>We have 2 possible solutions:</p>
  
  <ul>
  <li><p>Use a winapi call on the client to fix the path to be properly cased.  (These files are visible by a shared folder on the clients computer)</p></li>
  <li><p>Use some perl code on the server to locate a file with a case-insensitive path as input</p></li>
  </ul>
  
  <p>Any suggestions?  We would like this to work on all client machines that are Windows XP SP2 and higher.</p>
  
  <p>UPDATE: We decided it should be fixed client side, on the rare case that there is a case mismatch.</p>
  
  <p>We run this if we get a "file not found" error on the directory of the file.  Someone would have to modify this to work for files as well, but in our case the filename could never be wrong (I'd rather not explain why):</p>
  
  <pre><code>        string FixDirectory(string fullpath)
          {
              return fullpath
                  .Split(Path.DirectorySeparatorChar)
                  .Skip(1)
                  .Select(path =&gt;
                      {
                          string[] split = fullpath.Split(new string[] { path }, StringSplitOptions.None);
                          string tempDir = split[0];
                          string[] dirs = Directory.GetDirectories(tempDir, path);
                          fullpath = fullpath.Replace(Path.Combine(tempDir, path), dirs[0]);
                          return fullpath;
                      })
                  .Last();
          }
  </code></pre>