Why does isfolder() returns true when the argument is a space character in Windows OS?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 30 Aug. 2019
Beantwortet: MathWorks Support Team
am 27 Jan. 2020
The isfolder() function with the space " " as parameters returns true in Windows. Ia this expected?
Akzeptierte Antwort
MathWorks Support Team
am 30 Aug. 2019
Windows treats " " as a relative path and then trims trailing spaces. Essentially it does something like this:
input = " ";
Since input is not absolute,
input = fl::filesystem::absolute(input)
which turns the input space into "C:/Users/temp/ "
Hence, Windows trims the trailing spaces which leaves "C:/Users/temp".
While this may seem unexpected, it is logically consistent with Windows behavior. If you replace " " with something like "folderWithTrailingSpace" then you will get the same behavior.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!