geo-data / cesium-terrain-server

A basic server for serving up filesystem based tilesets representing Cesium.js terrain models
271 stars 111 forks source link

Logic inverted in TilesetStatus function in fs.go #2

Closed GeorgeDewar closed 9 years ago

GeorgeDewar commented 9 years ago

We have noticed a problem where if a tileset exists, the server will complain that it does not. Confusingly, the logic to check if the tileset exists is invoked only if the file requested does not exist, such as when asking for a nonexistant base layer or layers.json.

The problem seems to be this code:

func (this *Store) TilesetStatus(tileset string) (status stores.TilesetStatus) {
    // check whether the tile directory exists
    _, err := os.Stat(filepath.Join(this.root, tileset))
    if err != nil {
        if os.IsNotExist(err) {
            return stores.FOUND
        }
    }

    return stores.NOT_FOUND
}

It returns FOUND if there is an error, and NOT_FOUND if there is no error!

homme commented 9 years ago

You are absolutely right - thank you! Commit c92940f fixes this which I have tagged as v0.5.1.