Skip to content

Arduino IDE fails to start under windows if "Documents" directory is unavailable. #7097

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

Closed
WestfW opened this issue Jan 9, 2018 · 4 comments
Labels
Component: IDE The Arduino IDE OS: Windows Specific to the Windows version of the Arduino IDE Type: Bug

Comments

@WestfW
Copy link
Contributor

WestfW commented Jan 9, 2018

Early in its initialization, the Arduino cod calls Win32KnownFolders.getDocumentsFolder, which does a catch-less:
return new File(Shell32Util.getFolderPath(ShlObj.CSIDL_MYDOCUMENTS));

If the Documents folder is not accessible, this fails and throws an exception as shown by arduino_debug (see attached backtrace.)

This can be easily reproduced by creating a windows user and modifying their documents folder to be on a flash drive, ejecting the flash drive, and then trying to start Arduino. It can also occur if the Documents directory is configured to be on a network share that is unreachable.

Because this happens so early in the initialization, it fails even if the IDE has been installed in "portable" mode, which should prevent it from needing to access the Documents directory. (Thus: no known workaround.)

It looks like other code is prepared to deal with a null sketchbook path; perhaps all that is needed is ignoring the error...

See also this thread: http://forum.arduino.cc/index.php?topic=521015.msg3555956#msg3555956

@WestfW
Copy link
Contributor Author

WestfW commented Jan 9, 2018

Traceback:

C:\Users\breakme\Downloads\arduino\arduino-1.8.5>.\arduino_debug.exe
Looking for library 'user32'
Adding paths from jna.library.path: null
Trying user32.dll
Found library 'user32' at user32.dll
Looking for library 'shell32'
Adding paths from jna.library.path: null
Trying shell32.dll
Found library 'shell32' at shell32.dll
Looking for library 'Ole32'
Adding paths from jna.library.path: null
Trying Ole32.dll
Found library 'Ole32' at Ole32.dll
Looking for library 'kernel32'
Adding paths from jna.library.path: null
Trying kernel32.dll
Found library 'kernel32' at kernel32.dll
com.sun.jna.platform.win32.Win32Exception: The system cannot find the path specified.
at com.sun.jna.platform.win32.Shell32Util.getFolderPath(Shell32Util.java:48)
at com.sun.jna.platform.win32.Shell32Util.getFolderPath(Shell32Util.java:61)
at cc.arduino.os.windows.Win32KnownFolders.getDocumentsFolder(Win32KnownFolders.java:71)
at processing.app.windows.Platform.recoverDefaultSketchbookFolder(Platform.java:76)
at processing.app.windows.Platform.init(Platform.java:55)
at processing.app.Base.(Base.java:201)
at processing.app.Base.main(Base.java:144)

facchinm added a commit that referenced this issue Jan 10, 2018
Solves #7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
@facchinm
Copy link
Member

Hi @WestfW ,
I pushed 76fa511 to beta branch to overcome this issue. The build should be available soon.

@facchinm facchinm added Component: IDE The Arduino IDE Waiting for feedback More information must be provided before we can proceed OS: Windows Specific to the Windows version of the Arduino IDE labels Jan 10, 2018
facchinm added a commit that referenced this issue Jan 11, 2018
Solves #7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
@per1234
Copy link
Collaborator

per1234 commented Jan 16, 2018

From the forum thread (http://forum.arduino.cc/index.php?topic=521015.msg3559240#msg3559240)
WestfW said:

I can confirm that the latest. Beta code did fix my artificially broken terms system just fine

No word from the user who originally reported the issue yet.

facchinm added a commit to facchinm/Arduino that referenced this issue Jan 22, 2018
Solves arduino#7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
facchinm added a commit that referenced this issue Feb 16, 2018
Solves #7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
@facchinm facchinm added the IDE 1.9.x Beta Related to the Arduino IDE Beta Build label Mar 15, 2018
facchinm added a commit that referenced this issue Apr 12, 2018
Solves #7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
facchinm added a commit that referenced this issue Apr 17, 2018
Solves #7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
facchinm added a commit to facchinm/Arduino that referenced this issue May 8, 2018
Solves arduino#7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
cmaglie pushed a commit to facchinm/Arduino that referenced this issue May 8, 2018
Solves arduino#7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
cmaglie pushed a commit to facchinm/Arduino that referenced this issue May 9, 2018
Solves arduino#7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
facchinm added a commit that referenced this issue May 10, 2018
Solves #7097; the user will be prompted if default sketchbook folder doesn't exist.
If needed, the exception will be thrown by getDefaultSketchbookFolder() as in Linux/OSX implementations.
@per1234 per1234 removed the Waiting for feedback More information must be provided before we can proceed label Sep 16, 2019
@per1234
Copy link
Collaborator

per1234 commented Sep 16, 2019

The original reporter of the bug has reported to me that the problem is solved (via a PM on the forum) and I see the fix is merged into the master branch, so I'm going to close this as solved.

@per1234 per1234 closed this as completed Sep 16, 2019
@per1234 per1234 added Type: Bug and removed IDE 1.9.x Beta Related to the Arduino IDE Beta Build labels Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE The Arduino IDE OS: Windows Specific to the Windows version of the Arduino IDE Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants