tilemill-project / tilemill

TileMill is a modern map design studio
https://tilemill-project.github.io/tilemill/
BSD 3-Clause "New" or "Revised" License
3.12k stars 527 forks source link

Cannot add a layer datasource that has an apostrophe in the file name #2375

Open piratepoodle opened 10 years ago

piratepoodle commented 10 years ago

Dear TileMill Community,

Please help fix the following issue:

When trying to add a layer datasource that has an apostrophe in the file name the datasource cannot be added.

Workaround:

Check the full datasource path and rename the file without an apostrophe.

Error:

  File not found at absolute path:
  'C:\Users\%USERPROFILE%\Documents\%PROJECTNAME%\Public Transport\Britain'


  TileMill Error

  [tilemill] [tilemill] problem loading database Error: File not found at absolute
  path: 'C:\Users\%USERPROFILE%\Documents\%PROJECTNAME%\Public Transport\Britain'
  [tilemill] at C:\Program Files
  (x86)\TileMill-v0.10.1\tilemill\node_modules\millstone\lib\millstone.js:612:37
  [tilemill] at Object.fs.exists [as oncomplete] (fs.js:91.19)

  Please report this to https://github.com/mapbox/tilemill/issues

PC:

  System Type: 64-bit Operating System, x64-based Processor
  OS: Windows 8.1 Pro with Media Center
  Processor: AMD Phenom II X6 1035T 2.60 GHz
  RAM: 6.00 GB

TileMill Version: v0.10.1

Dataset:

  Source: Guardian datablog - Britain's transport infrastructure
  URL: https://www.google.com/fusiontables/DataSource?snapid=85105
  Filename: 'Britain's transport infrastructure.kml' (584MB)
  Download Link: https://www.google.com/fusiontables/embedviz?q=select+col4+from+15n7Rpi190vjrPcmbiT_hRcZ9JbXE8a_I1euHyg&viz=MAP&h=false&lat=50.66826496880198&lng=4.4000244140625&t=3&z=7&l=col4

Steps:

  1. Click "Start TileMill" from Windows 8 Start Screen
  2. Click on already existing project that only has the default #countries layer with the following style.mss code:

        Map {
          background-color: #b8dee6;
        }

        #countries {
          ::outline {
            line-color: #85c5d3;
            line-width: 2;
            line-join: round;
          }
          polygon-fill: #fff;
        }

  3. From the Layers menu click the "+ Add layer" button
  4. In "Add layer" dialog box enter the following information:

        ID: publicTransport
        Class: [left blank]

  5. Click on the 'Browse' button
  6. Navigate to the source folder path, for example 'C:\Users\%USERPROFILE%\Documents\%PROJECTNAME%\Public Transport\' and then click on the file named 'Britain's transport infrastructure.kml'.  Note that the path in the Datasource field omits the full file name after the apostrophe in the file name.
  7. Click on the 'Done' button.
  8a. From the 'Add layer' dialogue box click the 'Save' button, or
  8b. From the 'Add layer' dialogue box click the 'Save & Style' button
  9. TileMill error

Verbose Log:

  [tilemill] [tilemill] [library] path C:\Users\%USERPROFILE%\Documents\%PROJECTNAME%\Public Transport\Britain not found defaulting to home directory C:\Users\%USERPROFILE%
  [tilemill] [millstone] processing style 'layer'
  [tilemill] [millstone] processing layer 'publicTransport'
  [tilemill] [tilemill] problem loading datasource Error: File not found at absolute path: 'C:\Users\%USERPROFILE%\Documents\%PROJECTNAME%\Public Transport\Britain'
  [tilemill]     at C:\Program Files (x86)\TileMill-v0.10.1\tilemill\node_modules\millstone\lib\millstone.js:612:37
  [tilemill]     at Object.fs.exists [as oncomplete] (fs.js:91:19)
  [tilemill] [tilemill] [library] path C:\Users\%USERPROFILE%\Documents\%PROJECTNAME%\Public Transport\Britain not found defaulting to home directory C:\Users\%USERPROFILE%

Notes:

  Obviously I have redacted my personal information and substituted it with %USERPROFILE% and %PROJECTNAME%.
springmeyer commented 10 years ago

thanks for the report. I can replicate on OS X, but I don't see an easy/obvious way to fix. Please plan to stick with the workaround of re-naming the file.

piratepoodle commented 10 years ago

Perhaps someone can write some code so TileMill can automatically detect a file name with an apostrophe and notify the user of an incompatible file name and prompt to rename the file? This way the exception is handled before a crash.