diff --git a/docs/projectconf.rst b/docs/projectconf.rst index f340833b..f6835544 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -97,7 +97,11 @@ This option can be overridden by global environment variable ``envs_dir`` ^^^^^^^^^^^^ -This is a cache directory. *PlatformIO Build System* uses this folder for project +.. warning:: + **PLEASE DO NOT EDIT FILES IN THIS FOLDER**. PlatformIO will overwrite + your changes on the next build. **THIS IS A CACHE DIRECTORY**. + +*PlatformIO Build System* uses this folder for project environments to store compiled object files, static libraries, firmwares and other cached information. It allows PlatformIO to build source code extremely fast! diff --git a/platformio/util.py b/platformio/util.py index 864e0ea8..34850ff7 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -81,6 +81,7 @@ class cd(object): class memoized(object): + ''' Decorator. Caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned @@ -212,10 +213,18 @@ def get_projectlib_dir(): def get_pioenvs_dir(): - return _get_projconf_option_dir( + path = _get_projconf_option_dir( "envs_dir", join(get_project_dir(), ".pioenvs") ) + dontmod_path = join(path, "do-not-modify-files-here.url") + if not isfile(dontmod_path): + with open(dontmod_path, "w") as fp: + fp.write(""" +[InternetShortcut] +URL=http://docs.platformio.org/en/latest/projectconf.html#envs-dir +""") + return path def get_projectdata_dir():