gammasoft71/xtd

[BUG] xtd.tools - xtdc fails to generate new project by path only

baderouaich opened this issue ยท 6 comments

Describe the bug

xtdc causes xtdc-gui to fail to generate new project due a problem in arguments.

  • This command works: xtdc new gui -s xtd my_app -> creates a new project at local path/my_app
  • This command fails: xtdc new gui -s xtd C:\Users\bader\Desktop\my_app -> shows error message Unhandled exception: xtd::io::io_exception : I/O error occurred.

To Reproduce

Steps to reproduce the behavior:
Either use xtdc-gui to create any new project, or to get more information try to create a new xtd project using xtdc with a path instead of a name, as described in xtdc --help:
-n, --name The name for the project. If no name is specified, the name of the specified path or of the current directory is used.

Expected behaviour

Both commands with arguments path and name to work

Screenshots

image

Desktop (please complete the following information)

  • OS: Windows
  • Version: 10
  • xtd version: 0.2.0
  • xtdc version: 0.2.0

Workaround
I don't know if the problem is also occurring in other platforms but i will give it a test in Linux.
The culprit is more likely to be in xtdc.cpp get_project_name_from_path(), i will try to look it up.

For information, xtdc works correctly on macOS...

Works fine on Linux as well.

The problem could come from the process_start_info::shell_execute property which is set to true for Windows platform ?

Perhaps, but before process_start_info::shell_execute comes in place, something is going on with the io::path::get_full_path(), it returns invalid path as bellow:

e3 - Copy
e1 - Copy

There was already an error in the xtd::io::path::get_full_path method I just committed.

I see that there are no unit tests for xtd::io::path::get_full_path. Maybe you could add some to make sure there are no problems with this method and make sure there will be no more regressions. (If you don't know how to add them, I will).

Ah! I just noticed it has no tests yet. I will add some for xtd::io::path::get_full_path in xtd.core.unit_tests.io. that will be a better approach to see where the issue comes from.
I will keep you updated.