Plater icon indicating copy to clipboard operation
Plater copied to clipboard

crash when importing files from directory with too long path on Windows

Open vmario89 opened this issue 5 years ago • 14 comments

Hi,

Plater.exe crashes unexspectedly when pressing the "Add part(s)" button. The fix seems to put the files to some directories up to shorten the path. I am using Windows 10 64 Bit Pro Version.

grafik

I made some testings where i put the file chainy_v2.stl some dirs up until it works instead crashing. I just renamed the paths because they contained some info i dont want to publish here.

  • fail: C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\Gedöns\123456Design\Keyorganizer123456\STL Export\chainy_v2.stl
  • fail: C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\Gedöns\123456Design\Keyorganizer123456\chainy_v2.stl
  • fail: C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\Gedöns\123456Design\chainy_v2.stl
  • fail: C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\Gedöns\chainy_v2.stl
  • works: C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\chainy_v2.stl

grafik

maybe somebody has an idea how to fix it. regards, Mario

vmario89 avatar Oct 16 '19 22:10 vmario89

some add. info: seems also happening if path + filename in total get too long

vmario89 avatar Oct 16 '19 22:10 vmario89

Can you try the binaries from here: https://drive.google.com/open?id=1USaJTZzJk_7KIQr8ctoPnoI9gQ6FYcY9

combolek avatar Oct 31 '19 01:10 combolek

@combolek what fix did you make?

It can be also related to special chars (here the ö)

Gregwar avatar Oct 31 '19 06:10 Gregwar

Hi, thanks for the download @combolek . But the given executable has the same problem. Indeed i've overseen the special character Ö which is typical in europe. In general UTF-8 might be good solution because many countries have à á â and other chars in their daily used names.

I now renamed the folder and it works (but in my case a bad solution)

vmario89 avatar Oct 31 '19 09:10 vmario89

Ok @vmario89, I'm not saying you shouldn't use UTF-8 characters, but just trying to isolate what makes the program crash Do you confirm that the same PATH with and without the special char have different behavior?

Gregwar avatar Oct 31 '19 10:10 Gregwar

hi @Gregwar, yes the "ö" in path is the problem. I tested it with

"C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\Gedöns\123456Design\chainy_v2.stl" -> fail "C:\Users\mario\Seafile\cloud.123456-STLEXPOR.DD\Gedons\123456Design\chainy_v2.stl" -> good

regards, Mario

vmario89 avatar Oct 31 '19 10:10 vmario89

I was all wrong, ignore me.

combolek avatar Oct 31 '19 17:10 combolek

For the native MSVC build the following workaround works for me:

--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -13,6 +13,10 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin);
 
 int main(int argc, char *argv[])
 {
+#if defined(_MSC_VER)
+    // set default encoding for fopen/chdir/etc.
+    setlocale(LC_CTYPE, ".utf8");
+#endif
     QApplication a(argc, argv);
 
     QGLFormat glf = QGLFormat::defaultFormat();

@vmario89 can you try these binaries? https://drive.google.com/file/d/1ZdfkoLtuxTc07pidsPaVaUHsK0e3Y6kh/view?usp=sharing

But even if this works, it's only a partial solution because it cannot handle command line arguments (so it won't work for the plater.exe command line app). Also, I think the official build uses mingw (?) and this solution does not work then either.

combolek avatar Dec 26 '20 06:12 combolek

I figured out a better way to fix it, see PR #30. It requires Windows 10 1903 or later but it also handles paths on the command line.

@vmario89 can you try these updated binaries? https://drive.google.com/drive/folders/1USaJTZzJk_7KIQr8ctoPnoI9gQ6FYcY9

combolek avatar Mar 01 '21 02:03 combolek

Stopped crashing for me with your latest updated binaries @combolek

ameyp avatar Jun 07 '21 23:06 ameyp

Great, thanks for testing. Let's hope PR #30 will be merged.

combolek avatar Jun 08 '21 00:06 combolek

It is done

Gregwar avatar Jun 08 '21 07:06 Gregwar

Oh nice! Would it be possible to provide a recent binary download / release set?

regards, Mario :)

vmario89 avatar Jun 08 '21 09:06 vmario89

Did you try the ones from the link above?

combolek avatar Jun 08 '21 13:06 combolek