platformio / platformio/platformio-core

Linux incorrect project folder path generation

Open
#3,963 10 comments 2 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug home
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system: Ubuntu 20.4 (Python 3.8.5 & 3.9)

PlatformIO Version (platformio --version):
5.2.0a6,
Core 5.1.1
Home 3.3.4

pio system info
PlatformIO Core 5.2.0a6
Python 3.8.5-final.0
System Type linux_x86_64
Platform Linux-5.4.0-73-generic-x86_64-with-glibc2.29
File System Encoding utf-8
Locale Encoding UTF-8
PlatformIO Core Directory /home/USER/.platformio
PlatformIO Core Executable /home/USER/.platformio/penv/bin/platformio
Python Executable /home/USER/.platformio/penv/bin/python
Global Libraries 0
Development Platforms 0
Tools & Toolchains 0
Description of problem

I am currently facing a problem regarding project generation when working with core & home on ubuntu 20.4.
When creating a project from within the PlatformIO Home web interface all files will be created into the predefined path. But instead of forward slashes “/” backslashes “\” are used to divide the path. This obviously doesnt work on Linux systems. The project structure than is generated with the backslashes on my root directy (e.g. “/data\downloads\test_platform_io_esp_32_project”).
The issue is occuring when I create a project (and potentially when loading it as well) not when I add a new file.

I have installed Platform IO twice.
Once with pip install platformio and the other time with the recommended way Installer Script
Both end up with the same result.

Refering to platformio-community: linux-incorrect-project-folder-path-generation

Steps to Reproduce
  1. At the beginning the root-directory (":/") is not containing any platform-io related folder:
:/$ ls
bin   cdrom  dev  home  lib32  libx32      media  opt   root  sbin  snap  swap.img  tmp  var
boot  data   etc  lib   lib64  lost+found  mnt    proc  run srv   sys       usr
  1. Starting the server with the activated Installer Script virtualenv in the folder data/platform-io-testing:
    (penv) data/platform-io-testing:/$ pio home --host 127.0.0.1 --port 800

  2. open localhost:800/ and create a new project with the name "new_test_project" in the folder "data/platform-io-testing"

  3. It gets created and I recieve the message:

Project has been successfully initialized
Board: esp32doit-devkit-v1, framework: arduino, location: /data\platform-io-testing\new_test_project
Actual Results

Which is correct. When I now list the content of the root directory I find the directory:

 bin     data                      dev    lib     libx32       mnt    root   swap.img   usr
 boot   'data\platform-io-testing\new_test_project'   etc    lib32   lost+found   opt    run    snap                        sys        var
 cdrom  home   lib64   media        proc   sbin   srv                         tmp

But the folder is no where near to be found in /data/platform-io-testing/new_test_project
If I list the content of this incorrect path all the jucy platform-io files can befound (platformio.ini etc.)

Expected Results

I expect to find the created project in /data/platform-io-testing/new_test_project

Additional info

To make reproducing the problem easier, I have created a docker container (heavily inspired by sglahn:https://github.com/sglahn/docker-platformio-core/blob/master/Dockerfile)

FROM python:3.8.5-slim

USER root

RUN pip install -U platformio==5.1.1 && \
    mkdir -p /workspace && \
    mkdir -p /.platformio && \
    chmod a+rwx /.platformio && \
    apt update && \
    apt install -y git && \
    apt-get clean autoclean && \
    apt-get autoremove --yes && \
    rm -rf /var/lib/{apt,dpkg,cache,log}/
    
USER 1000
WORKDIR /workspace
EXPOSE 800

ENTRYPOINT ["pio", "home", "--host", "0.0.0.0", "--port", "800"]
docker build -t platform-io .
docker run -p 8403:800 --name platform-io -v %LOCAL_PATH_TO_PROJECTS%:/Documents/PlatformIO/Projects -d -it platform-io 
docker logs -f platform-io

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.