mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fix project saving
This commit is contained in:
@ -13,7 +13,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import io
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -449,9 +448,12 @@ class ProjectConfig(ProjectConfigBase, ProjectConfigDirsMixin):
|
|||||||
path = path or self.path
|
path = path or self.path
|
||||||
if path in self._instances:
|
if path in self._instances:
|
||||||
del self._instances[path]
|
del self._instances[path]
|
||||||
with open(path or self.path, "w") as fp:
|
with open(path or self.path, "w+") as fp:
|
||||||
fp.write(CONFIG_HEADER.strip())
|
fp.write(CONFIG_HEADER.strip() + "\n\n")
|
||||||
buf = io.BytesIO() if PY2 else io.StringIO()
|
self._parser.write(fp)
|
||||||
self._parser.write(buf)
|
fp.seek(0)
|
||||||
fp.write("\n\n%s\n" % buf.getvalue().strip())
|
contents = fp.read()
|
||||||
|
fp.seek(0)
|
||||||
|
fp.truncate()
|
||||||
|
fp.write(contents.strip() + "\n")
|
||||||
return True
|
return True
|
||||||
|
@ -330,6 +330,7 @@ board = myboard
|
|||||||
]
|
]
|
||||||
|
|
||||||
config.save()
|
config.save()
|
||||||
|
print(tmpdir)
|
||||||
contents = tmpdir.join("platformio.ini").read()
|
contents = tmpdir.join("platformio.ini").read()
|
||||||
assert contents[-4:] == "yes\n"
|
assert contents[-4:] == "yes\n"
|
||||||
lines = [
|
lines = [
|
||||||
|
Reference in New Issue
Block a user