stockpiles: more error handling & cleanup

* prevent crashes when the path doesn't exist
* remove duplicated functions
* sort file list case insensitively
* (lethsor) Create stocksettings directory on startup if necessary
* display errors in the GUI when necessary
* handle older versions of DFHack without the persist module