SpartanJ / ecode

Lightweight multi-platform code editor designed for modern hardware with a focus on responsiveness and performance.
MIT License
941 stars 13 forks source link

Build Configuration -> del is not run in windows(workaround) #273

Closed shyperson0 closed 7 months ago

shyperson0 commented 7 months ago
    2024-05-02 22:05:09: Running steps for project devel...  
    2024-05-02 22:05:09: Starting del C:\Users\pc\mini3d\build\*.exe  
    2024-05-02 22:05:09: Working Dir C:\Users\pc\mini3d\  
    2024-05-02 22:05:09: Elapsed Time: 12.57ms.  
    2024-05-02 22:05:09: Clean run with errors  

copy pasting del C:\Users\pc\mini3d\build\*.exe straight outta the build output into a terminal works just fine. setting terminal to powershell and using rm doesn't seem to work either.

project_build.json

    {  
      "devel": {  
        "build": [  
          {  
            "args": "-O3 mini3d.c -o ${project_root}build\\mini3devel.exe -lgdi32",  
            "command": "gcc",  
            "working_dir": "${project_root}"  
          }  
        ],  
        "build_types": [],  
        "clean": [  
          {  
            "args": "${project_root}build\\*.exe",  
            "command": "del",  
            "working_dir": "${project_root}"  
          }  
        ],  
        "config": {  
          "clear_sys_env": false  
        },  
        "os": [],  
        "output_parser": {  
          "config": {  
            "relative_file_paths": true  
          }  
        },  
        "run": [  
          {  
            "args": "",  
            "command": "${project_root}build\\mini3devel.exe",  
            "name": "Custom Executable",  
            "run_in_terminal": true,  
            "working_dir": "${project_root}"  
          }  
        ]  
      }  
    }  

using a bat file containing del C:\Users\pc\mini3d\build\*.exe works just fine.

    "clean": [  
      {  
        "args": "",  
        "command": "${project_root}clean.bat",  
        "working_dir": "${project_root}"  
      }  
    ]  
SpartanJ commented 7 months ago

Hi! This is not a bug, but a misunderstanding of what the * actually does or where it's executed. Wildcard expansion is a feature of the shell (and it's pretty much standard on any shell except for the old cmd.exe that it has a partial implementation), but the build step cannot and does not run in the shell (only the run step), so using * in this context doesn't mean anything, it will simply try to delete the file called *.exe. Trying to clarify a little bit further: the build step simply executes a process with some arguments, the concept of wildcard expansion doesn't exists here. As you mentioned, using a shell script is the easiest solution.