-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Path names problem in 1.5 IDE's platforms.txt #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is having a mix an actual problem on Windows? I think we would have heard complaints if it were? Or is avrude internally fixing this up and are there other tools that don't do this? |
Yes, Windows only accepts backslash and Linux only forward slash. Assume AVRDUDE must map these since its an argument passed, but I found the problem when trying to do the remote SCP/SSH programmer and hit the problem, hence why I raise it. There is no point having some confusion built in, particularly if the Arduino platform can do .windows and .Linux suffixes for each OS. Failure to fix it means that others will have to :
So, why not just fix it in the platforms.txt file ??? For an example, look at this line from platforms.txt - the /U flag. The result is a path with the build path being OS generated and backslash on windows, followed by a forward slash and the project name. |
Right, I understand the problem now. Fixing this by duplicating every command that uses a path with a windows-specific version is possible, but I don't like that much (because of the duplication). If we can thinking of a more generic way to fix this, that would be better. However, as you already pointed out, we can't just globally replace / with \ in the command, since that will screw up commandline switches. I can't think of any other elegant way to fix this right now, so duplicating the commands might be the way to go. Disclaimer: I'm not not an official dev, so my opinion isn't binding in any way :-) |
Can you be more specific where it gives problems? I mean: I assume that with SCP/SSH you mean the yun upload. I have implemented this in eclipse and did not have any problems. |
Hi Jantje. My point is that the directory rules for each OS are well documented and the IDE needs to follow them, like other standards, otherwise when people try and do any form of extension in this area, they will have to find this issue and work around it. So, for consistency the IDE's configuration files need to handle this correctly for each OS. Yes, AVRDUDE does have some work-around in place for this, but we should not rely on this or assume that all other tools will have the same capabilities to work around this bug. |
@tchilton
Probably it's better if you can show your specific problem? |
We can use a keyword like &slash& (or anything) which we will use in place of '/' and avrdude will itself replace that keyword with the appropriate form of slash for the respective platform. |
Yeah, a property named |
In my humble opinion this will make the the platform.txt file less readable. @tchilton maybe you should take a look at how yun does the upload. Basically it opens a ssh shell and runs some commands (without parameters). If you implement these commands on your target OS -and have them in your path- you can upload as if you have a yun. I did so with a linksys router and openwrt (before linino became openwrt) |
Hi @jantje Just for the record: the IDE already does OS detection with the Base.isWindows() method here C |
@cmaglie |
Ah ok, I missed that "target platform" part. Any target platform, especially if it's a remote target, is on its own to handle platform specific stuff, no remote OS detection performed by the IDE. The solution I proposed was to provide a {sep} variable for the recipes, but only for the OS that is currently running the IDE, so for example the recipe:
can be rewritten as:
but, again, before proceeding I'll wait to see an example that shows the actual problem. |
Lots of comments.. Lots of questions
I raised this defect since its caused problems (as it did in my case). Windows common knowledge is backslash is the path separator, so why make it harder than this in the example config files ?? I've fixed my issue, I've reported the problem I found in this thread. Take it or leave it - I don't care any more. |
Whether the type of slash in a parameter depends entirely on user application. Some may handle a mix, some may not. However the correct method on Windows is to use backslash, therefore this is what Arduino should pass to external tools. |
Isn't it amazing that so much can be written about such a trivial issue with so little actual result!? This issue is not unlike the normalization step that exist in IP to ensure a consistent endian-ness accross the board. The point is that having to deal with normalized versus specific representation of the same information is something programmers have had to deal with for at least 40years. |
@lmihalkovic, at least read the issue before doing such harsh comments. This issue started from the false assumption that Windows only handle paths with backslash while is perfectly capable of handling path with both forward and backslash (even mixed). The OP failed to show a use case when the actual setup fails, so I'm closing this issue as "works for me". |
@cmaglie Precisely! I was referring to the amount of discussion, proposal, opinions that got expressed around something as small as a path 'problem'. It would surely be nice if the code/configs were more consistent when dealing with paths, but it can be hapily ignored due to the foregiveness of Windows. IMHO there are many more entries showing a similar pattern of long discussions with elaborate arguments on various sides of mis-diagnosed 'problems', which prompt me to regularly say that your codebase is full of opportunities for useful improvements when your peel-off the layers of misunderstanding around these issues/features. Or in the words of someone much more eloquent: |
Although it seems to work with avrdude, there are consistency problems in the platforms.txt file's handling of paths. All the paths in tools.avrdude have Linux forward slashes, which results in the path names having a mix of forward and backslashes on the Windows platform. This can be seen by turning on verbose mode for an upload or opening the platforms.txt
This will be a problem for other integrating other programmers as they will probably copy the avrdude section (like I did)
Suggest that the platforms.txt should have both .windows and .Linux constructs by default, or possibly the IDE performs some form of sanity check on pathnames before attempting to execute them - although differentiating paths and switches could be tricky !
The text was updated successfully, but these errors were encountered: