forked from platformio/platformio-core
Normalize Windows path with Python's pathlib
This commit is contained in:
@ -15,6 +15,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from platformio import __version__, app, fs, util
|
from platformio import __version__, app, fs, util
|
||||||
from platformio.project.config import ProjectConfig
|
from platformio.project.config import ProjectConfig
|
||||||
@ -66,7 +67,7 @@ class AppRPC:
|
|||||||
# skip non-existing recent projects
|
# skip non-existing recent projects
|
||||||
storage["recentProjects"] = list(
|
storage["recentProjects"] = list(
|
||||||
set(
|
set(
|
||||||
os.path.normpath(p)
|
str(Path(p).resolve())
|
||||||
for p in storage.get("recentProjects", [])
|
for p in storage.get("recentProjects", [])
|
||||||
if is_platformio_project(p)
|
if is_platformio_project(p)
|
||||||
)
|
)
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from ajsonrpc.core import JSONRPC20DispatchException
|
from ajsonrpc.core import JSONRPC20DispatchException
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class IDERPC:
|
|||||||
if cmd_id not in self._cmd_queue:
|
if cmd_id not in self._cmd_queue:
|
||||||
return
|
return
|
||||||
if self._cmd_queue[cmd_id]["method"] == "get_pio_project_dirs":
|
if self._cmd_queue[cmd_id]["method"] == "get_pio_project_dirs":
|
||||||
value = [os.path.normpath(p) for p in value]
|
value = [str(Path(p).resolve()) for p in value]
|
||||||
self._cmd_queue[cmd_id]["future"].set_result(value)
|
self._cmd_queue[cmd_id]["future"].set_result(value)
|
||||||
del self._cmd_queue[cmd_id]
|
del self._cmd_queue[cmd_id]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user