diff --git a/.classpath b/.classpath index b68e5e764..180a6b7c2 100644 --- a/.classpath +++ b/.classpath @@ -6,7 +6,6 @@ - diff --git a/app/.classpath b/app/.classpath index 356c15869..8d33d0678 100644 --- a/app/.classpath +++ b/app/.classpath @@ -4,7 +4,6 @@ - diff --git a/app/.classpath_macosx b/app/.classpath_macosx index 26775c499..7626e5774 100644 --- a/app/.classpath_macosx +++ b/app/.classpath_macosx @@ -14,7 +14,6 @@ - diff --git a/app/.classpath_vista b/app/.classpath_vista deleted file mode 100644 index c7ec5acb9..000000000 --- a/app/.classpath_vista +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/app/lib/jna.LICENSE.LGPL-2.1.txt b/app/lib/jna.LICENSE.LGPL-2.1.txt deleted file mode 100644 index 006e9f090..000000000 --- a/app/lib/jna.LICENSE.LGPL-2.1.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/twall/jna/blob/master/LICENSE diff --git a/app/lib/jna.jar b/app/lib/jna.jar deleted file mode 100644 index 5c669aff6..000000000 Binary files a/app/lib/jna.jar and /dev/null differ diff --git a/app/run-linux.launch b/app/run-linux.launch deleted file mode 100644 index 9ad239a8b..000000000 --- a/app/run-linux.launch +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/cc/arduino/view/preferences/Preferences.form b/app/src/cc/arduino/view/preferences/Preferences.form index 8f6215f66..e7d0ac5a2 100644 --- a/app/src/cc/arduino/view/preferences/Preferences.form +++ b/app/src/cc/arduino/view/preferences/Preferences.form @@ -617,13 +617,6 @@ - - - - - - - diff --git a/app/src/cc/arduino/view/preferences/Preferences.java b/app/src/cc/arduino/view/preferences/Preferences.java index 584b1bcb5..8bfcb3a6b 100644 --- a/app/src/cc/arduino/view/preferences/Preferences.java +++ b/app/src/cc/arduino/view/preferences/Preferences.java @@ -34,7 +34,6 @@ import processing.app.Editor; import processing.app.I18n; import processing.app.PreferencesData; import processing.app.helpers.FileUtils; -import processing.app.helpers.OSUtils; import processing.app.legacy.PApplet; import javax.swing.*; @@ -198,11 +197,6 @@ public class Preferences extends javax.swing.JDialog { } }); - if (!OSUtils.isWindows() || base.getPortableFolder() != null) { - autoAssociateBox.setEnabled(false); - autoAssociateBox.getParent().remove(autoAssociateBox); - } - showPrerefencesData(); } @@ -256,7 +250,6 @@ public class Preferences extends javax.swing.JDialog { externalEditorBox = new javax.swing.JCheckBox(); checkUpdatesBox = new javax.swing.JCheckBox(); updateExtensionBox = new javax.swing.JCheckBox(); - autoAssociateBox = new javax.swing.JCheckBox(); saveVerifyUploadBox = new javax.swing.JCheckBox(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); @@ -445,9 +438,6 @@ public class Preferences extends javax.swing.JDialog { updateExtensionBox.setText(_("Update sketch files to new extension on save (.pde -> .ino)")); checkboxesContainer.add(updateExtensionBox); - autoAssociateBox.setText(_("Automatically associate .ino files with Arduino")); - checkboxesContainer.add(autoAssociateBox); - saveVerifyUploadBox.setText(_("Save when verifying or uploading")); checkboxesContainer.add(saveVerifyUploadBox); @@ -610,7 +600,6 @@ public class Preferences extends javax.swing.JDialog { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField additionalBoardsManagerField; - private javax.swing.JCheckBox autoAssociateBox; private javax.swing.JCheckBox checkUpdatesBox; private javax.swing.JComboBox comboLanguage; private javax.swing.JComboBox comboWarnings; @@ -683,10 +672,6 @@ public class Preferences extends javax.swing.JDialog { PreferencesData.setBoolean("editor.update_extension", updateExtensionBox.isSelected()); - if (autoAssociateBox != null) { - PreferencesData.setBoolean("platform.auto_file_type_associations", autoAssociateBox.isSelected()); - } - PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected()); PreferencesData.set("proxy.http.server", proxyHTTPServer.getText()); @@ -744,10 +729,6 @@ public class Preferences extends javax.swing.JDialog { updateExtensionBox.setSelected(PreferencesData.get("editor.update_extension") == null || PreferencesData.getBoolean("editor.update_extension")); - if (autoAssociateBox != null) { - autoAssociateBox.setSelected(PreferencesData.getBoolean("platform.auto_file_type_associations")); - } - saveVerifyUploadBox.setSelected(PreferencesData.getBoolean("editor.save_on_verify")); proxyHTTPServer.setText(PreferencesData.get("proxy.http.server")); diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 1bd519769..1fb72fc46 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -146,6 +146,8 @@ public class Base { initPlatform(); + getPlatform().init(); + BaseNoGui.initPortableFolder(); BaseNoGui.initParameters(args); @@ -284,8 +286,6 @@ public class Base { } public Base(String[] args) throws Exception { - getPlatform().init(); - String sketchbookPath = BaseNoGui.getSketchbookPath(); // If no path is set, get the default sketchbook folder for this platform diff --git a/app/test/processing/app/windows/RegQueryParserTest.java b/app/test/processing/app/windows/RegQueryParserTest.java new file mode 100644 index 000000000..c1b0ae758 --- /dev/null +++ b/app/test/processing/app/windows/RegQueryParserTest.java @@ -0,0 +1,29 @@ +package processing.app.windows; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class RegQueryParserTest { + + @Test + public void testRegQueryParser() throws Exception { + String output = "! REG.EXE VERSION 3.0\n" + + "\n" + + "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n" + + "\n" + + " Local AppData REG_SZ C:\\Documents and Settings\\username\\My Documents"; + + String folderPath = new RegQueryParser(output).getValueOfKey(); + assertEquals("C:\\Documents and Settings\\username\\My Documents", folderPath); + } + + @Test + public void testRegQueryParser2() throws Exception { + String output = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\n" + + " Local AppData REG_SZ C:\\Users\\username\\AppData\\Local"; + + String folderPath = new RegQueryParser(output).getValueOfKey(); + assertEquals("C:\\Users\\username\\AppData\\Local", folderPath); + } +} diff --git a/arduino-core/.classpath b/arduino-core/.classpath index cd3604c15..b0e162044 100644 --- a/arduino-core/.classpath +++ b/arduino-core/.classpath @@ -2,7 +2,6 @@ - diff --git a/arduino-core/lib/jna.LICENSE.LGPL-2.1.txt b/arduino-core/lib/jna.LICENSE.LGPL-2.1.txt deleted file mode 100644 index 006e9f090..000000000 --- a/arduino-core/lib/jna.LICENSE.LGPL-2.1.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/twall/jna/blob/master/LICENSE diff --git a/arduino-core/lib/jna.jar b/arduino-core/lib/jna.jar deleted file mode 100644 index 5c669aff6..000000000 Binary files a/arduino-core/lib/jna.jar and /dev/null differ diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index 9ae944cfe..139b72335 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -425,8 +425,6 @@ public class BaseNoGui { } static public void init(String[] args) throws Exception { - getPlatform().init(); - String sketchbookPath = getSketchbookPath(); // If no path is set, get the default sketchbook folder for this platform @@ -740,7 +738,9 @@ public class BaseNoGui { Runtime.getRuntime().addShutdownHook(new Thread(DeleteFilesOnShutdown.INSTANCE)); initPlatform(); - + + getPlatform().init(); + initPortableFolder(); initParameters(args); diff --git a/arduino-core/src/processing/app/macosx/Platform.java b/arduino-core/src/processing/app/macosx/Platform.java index 7dc206635..4ff946388 100644 --- a/arduino-core/src/processing/app/macosx/Platform.java +++ b/arduino-core/src/processing/app/macosx/Platform.java @@ -57,6 +57,8 @@ public class Platform extends processing.app.Platform { } public void init() throws IOException { + super.init(); + System.setProperty("apple.laf.useScreenMenuBar", "true"); discoverRealOsArch(); diff --git a/arduino-core/src/processing/app/windows/Advapi32.java b/arduino-core/src/processing/app/windows/Advapi32.java deleted file mode 100644 index 203fb74d7..000000000 --- a/arduino-core/src/processing/app/windows/Advapi32.java +++ /dev/null @@ -1,335 +0,0 @@ -package processing.app.windows; - -/* - * Advapi32.java - * - * Created on 6. August 2007, 11:24 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -import com.sun.jna.*; -import com.sun.jna.ptr.*; -import com.sun.jna.win32.*; - -/** - * - * @author TB - */ -public interface Advapi32 extends StdCallLibrary { - Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32", Advapi32.class, Options.UNICODE_OPTIONS); - -/* -BOOL WINAPI LookupAccountName( - LPCTSTR lpSystemName, - LPCTSTR lpAccountName, - PSID Sid, - LPDWORD cbSid, - LPTSTR ReferencedDomainName, - LPDWORD cchReferencedDomainName, - PSID_NAME_USE peUse -);*/ - public boolean LookupAccountName(String lpSystemName, String lpAccountName, - byte[] Sid, IntByReference cbSid, char[] ReferencedDomainName, - IntByReference cchReferencedDomainName, PointerByReference peUse); - -/* -BOOL WINAPI LookupAccountSid( - LPCTSTR lpSystemName, - PSID lpSid, - LPTSTR lpName, - LPDWORD cchName, - LPTSTR lpReferencedDomainName, - LPDWORD cchReferencedDomainName, - PSID_NAME_USE peUse -);*/ - public boolean LookupAccountSid(String lpSystemName, byte[] Sid, - char[] lpName, IntByReference cchName, char[] ReferencedDomainName, - IntByReference cchReferencedDomainName, PointerByReference peUse); - -/* -BOOL ConvertSidToStringSid( - PSID Sid, - LPTSTR* StringSid -);*/ - public boolean ConvertSidToStringSid(byte[] Sid, PointerByReference StringSid); - -/* -BOOL WINAPI ConvertStringSidToSid( - LPCTSTR StringSid, - PSID* Sid -);*/ - public boolean ConvertStringSidToSid(String StringSid, PointerByReference Sid); - -/* -SC_HANDLE WINAPI OpenSCManager( - LPCTSTR lpMachineName, - LPCTSTR lpDatabaseName, - DWORD dwDesiredAccess -);*/ - public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName, int dwDesiredAccess); - -/* -BOOL WINAPI CloseServiceHandle( - SC_HANDLE hSCObject -);*/ - public boolean CloseServiceHandle(Pointer hSCObject); - -/* -SC_HANDLE WINAPI OpenService( - SC_HANDLE hSCManager, - LPCTSTR lpServiceName, - DWORD dwDesiredAccess -);*/ - public Pointer OpenService(Pointer hSCManager, String lpServiceName, int dwDesiredAccess); - -/* -BOOL WINAPI StartService( - SC_HANDLE hService, - DWORD dwNumServiceArgs, - LPCTSTR* lpServiceArgVectors -);*/ - public boolean StartService(Pointer hService, int dwNumServiceArgs, char[] lpServiceArgVectors); - -/* -BOOL WINAPI ControlService( - SC_HANDLE hService, - DWORD dwControl, - LPSERVICE_STATUS lpServiceStatus -);*/ - public boolean ControlService(Pointer hService, int dwControl, SERVICE_STATUS lpServiceStatus); - -/* -BOOL WINAPI StartServiceCtrlDispatcher( - const SERVICE_TABLE_ENTRY* lpServiceTable -);*/ - public boolean StartServiceCtrlDispatcher(Structure[] lpServiceTable); - -/* -SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandler( - LPCTSTR lpServiceName, - LPHANDLER_FUNCTION lpHandlerProc -);*/ - public Pointer RegisterServiceCtrlHandler(String lpServiceName, Handler lpHandlerProc); - -/* -SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerEx( - LPCTSTR lpServiceName, - LPHANDLER_FUNCTION_EX lpHandlerProc, - LPVOID lpContext -);*/ - public Pointer RegisterServiceCtrlHandlerEx(String lpServiceName, HandlerEx lpHandlerProc, Pointer lpContext); - -/* -BOOL WINAPI SetServiceStatus( - SERVICE_STATUS_HANDLE hServiceStatus, - LPSERVICE_STATUS lpServiceStatus -);*/ - public boolean SetServiceStatus(Pointer hServiceStatus, SERVICE_STATUS lpServiceStatus); - -/* -SC_HANDLE WINAPI CreateService( - SC_HANDLE hSCManager, - LPCTSTR lpServiceName, - LPCTSTR lpDisplayName, - DWORD dwDesiredAccess, - DWORD dwServiceType, - DWORD dwStartType, - DWORD dwErrorControl, - LPCTSTR lpBinaryPathName, - LPCTSTR lpLoadOrderGroup, - LPDWORD lpdwTagId, - LPCTSTR lpDependencies, - LPCTSTR lpServiceStartName, - LPCTSTR lpPassword -);*/ - public Pointer CreateService(Pointer hSCManager, String lpServiceName, String lpDisplayName, - int dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl, - String lpBinaryPathName, String lpLoadOrderGroup, IntByReference lpdwTagId, - String lpDependencies, String lpServiceStartName, String lpPassword); - -/* -BOOL WINAPI DeleteService( - SC_HANDLE hService -);*/ - public boolean DeleteService(Pointer hService); - -/* -BOOL WINAPI ChangeServiceConfig2( - SC_HANDLE hService, - DWORD dwInfoLevel, - LPVOID lpInfo -);*/ - public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel, ChangeServiceConfig2Info lpInfo); - -/* -LONG WINAPI RegOpenKeyEx( - HKEY hKey, - LPCTSTR lpSubKey, - DWORD ulOptions, - REGSAM samDesired, - PHKEY phkResult -);*/ - public int RegOpenKeyEx(int hKey, String lpSubKey, int ulOptions, int samDesired, IntByReference phkResult); - -/* -LONG WINAPI RegQueryValueEx( - HKEY hKey, - LPCTSTR lpValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData -);*/ - public int RegQueryValueEx(int hKey, String lpValueName, IntByReference lpReserved, IntByReference lpType, byte[] lpData, IntByReference lpcbData); - -/* -LONG WINAPI RegCloseKey( - HKEY hKey -);*/ - public int RegCloseKey(int hKey); - -/* -LONG WINAPI RegDeleteValue( - HKEY hKey, - LPCTSTR lpValueName -);*/ - public int RegDeleteValue(int hKey, String lpValueName); - -/* -LONG WINAPI RegSetValueEx( - HKEY hKey, - LPCTSTR lpValueName, - DWORD Reserved, - DWORD dwType, - const BYTE* lpData, - DWORD cbData -);*/ - public int RegSetValueEx(int hKey, String lpValueName, int Reserved, int dwType, byte[] lpData, int cbData); - -/* -LONG WINAPI RegCreateKeyEx( - HKEY hKey, - LPCTSTR lpSubKey, - DWORD Reserved, - LPTSTR lpClass, - DWORD dwOptions, - REGSAM samDesired, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, - PHKEY phkResult, - LPDWORD lpdwDisposition -);*/ - public int RegCreateKeyEx(int hKey, String lpSubKey, int Reserved, String lpClass, int dwOptions, - int samDesired, WINBASE.SECURITY_ATTRIBUTES lpSecurityAttributes, IntByReference phkResult, - IntByReference lpdwDisposition); - -/* -LONG WINAPI RegDeleteKey( - HKEY hKey, - LPCTSTR lpSubKey -);*/ - public int RegDeleteKey(int hKey, String name); - -/* -LONG WINAPI RegEnumKeyEx( - HKEY hKey, - DWORD dwIndex, - LPTSTR lpName, - LPDWORD lpcName, - LPDWORD lpReserved, - LPTSTR lpClass, - LPDWORD lpcClass, - PFILETIME lpftLastWriteTime -);*/ - public int RegEnumKeyEx(int hKey, int dwIndex, char[] lpName, IntByReference lpcName, IntByReference reserved, - char[] lpClass, IntByReference lpcClass, WINBASE.FILETIME lpftLastWriteTime); - -/* -LONG WINAPI RegEnumValue( - HKEY hKey, - DWORD dwIndex, - LPTSTR lpValueName, - LPDWORD lpcchValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData -);*/ - public int RegEnumValue(int hKey, int dwIndex, char[] lpValueName, IntByReference lpcchValueName, IntByReference reserved, - IntByReference lpType, byte[] lpData, IntByReference lpcbData); - - interface SERVICE_MAIN_FUNCTION extends StdCallCallback { - /* - VOID WINAPI ServiceMain( - DWORD dwArgc, - LPTSTR* lpszArgv - );*/ - public void callback(int dwArgc, Pointer lpszArgv); - } - - interface Handler extends StdCallCallback { - /* - VOID WINAPI Handler( - DWORD fdwControl - );*/ - public void callback(int fdwControl); - } - - interface HandlerEx extends StdCallCallback { - /* - DWORD WINAPI HandlerEx( - DWORD dwControl, - DWORD dwEventType, - LPVOID lpEventData, - LPVOID lpContext - );*/ - public void callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext); - } - -/* -typedef struct _SERVICE_STATUS { - DWORD dwServiceType; - DWORD dwCurrentState; - DWORD dwControlsAccepted; - DWORD dwWin32ExitCode; - DWORD dwServiceSpecificExitCode; - DWORD dwCheckPoint; - DWORD dwWaitHint; -} SERVICE_STATUS, - *LPSERVICE_STATUS;*/ - public static class SERVICE_STATUS extends Structure { - public int dwServiceType; - public int dwCurrentState; - public int dwControlsAccepted; - public int dwWin32ExitCode; - public int dwServiceSpecificExitCode; - public int dwCheckPoint; - public int dwWaitHint; - } - -/* -typedef struct _SERVICE_TABLE_ENTRY { - LPTSTR lpServiceName; - LPSERVICE_MAIN_FUNCTION lpServiceProc; -} SERVICE_TABLE_ENTRY, - *LPSERVICE_TABLE_ENTRY;*/ - public static class SERVICE_TABLE_ENTRY extends Structure { - public String lpServiceName; - public SERVICE_MAIN_FUNCTION lpServiceProc; - } - - public static class ChangeServiceConfig2Info extends Structure { - } - -/* - typedef struct _SERVICE_DESCRIPTION { - LPTSTR lpDescription; -} SERVICE_DESCRIPTION, - *LPSERVICE_DESCRIPTION;*/ - public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info { - public String lpDescription; - } -} - - diff --git a/arduino-core/src/processing/app/windows/Options.java b/arduino-core/src/processing/app/windows/Options.java deleted file mode 100644 index acbf43d7c..000000000 --- a/arduino-core/src/processing/app/windows/Options.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Options.java - * - * Created on 8. August 2007, 17:07 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package processing.app.windows; - -import static com.sun.jna.Library.*; -import com.sun.jna.win32.*; -import java.util.*; - -/** - * - * @author TB - */ -public interface Options { - @SuppressWarnings("serial") - Map UNICODE_OPTIONS = new HashMap() { - { - put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE); - put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE); - } - }; -} diff --git a/arduino-core/src/processing/app/windows/Platform.java b/arduino-core/src/processing/app/windows/Platform.java index cfc2f497d..306d2a954 100644 --- a/arduino-core/src/processing/app/windows/Platform.java +++ b/arduino-core/src/processing/app/windows/Platform.java @@ -24,126 +24,51 @@ package processing.app.windows; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.Executor; -import processing.app.PreferencesData; import processing.app.debug.TargetPackage; import processing.app.legacy.PApplet; import processing.app.legacy.PConstants; import processing.app.tools.CollectStdOutExecutor; -import processing.app.windows.Registry.REGISTRY_ROOT_KEY; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.util.LinkedList; import java.util.List; import java.util.Map; -// http://developer.apple.com/documentation/QuickTime/Conceptual/QT7Win_Update_Guide/Chapter03/chapter_3_section_1.html -// HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\QuickTime\QTSysDir - -// HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion -> 1.6 (String) -// HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion\1.6\JavaHome -> c:\jdk-1.6.0_05 - public class Platform extends processing.app.Platform { - static final String openCommand = - System.getProperty("user.dir").replace('/', '\\') + - "\\arduino.exe \"%1\""; - static final String DOC = "Arduino.Document"; + private File settingsFolder; + private File defaultSketchbookFolder; public void init() throws IOException { super.init(); - checkAssociations(); - checkQuickTime(); checkPath(); + recoverSettingsFolderPath(); + recoverDefaultSketchbookFolder(); } - - /** - * Make sure that .pde files are associated with processing.exe. - */ - protected void checkAssociations() { - try { - String knownCommand = - Registry.getStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, - DOC + "\\shell\\open\\command", ""); - if (knownCommand == null) { - if (PreferencesData.getBoolean("platform.auto_file_type_associations")) { - setAssociations(); - } - - } else if (!knownCommand.equals(openCommand)) { - // If the value is set differently, just change the registry setting. - if (PreferencesData.getBoolean("platform.auto_file_type_associations")) { - setAssociations(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } + private void recoverSettingsFolderPath() throws IOException { + String path = getFolderPathFromRegistry("AppData"); + this.settingsFolder = new File(path, "Arduino15"); } - - /** - * Associate .pde files with this version of Processing. - */ - protected void setAssociations() throws UnsupportedEncodingException { - if (Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, - "", ".ino") && - Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, - ".ino", "", DOC) && - - Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, "", DOC) && - Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, DOC, "", - "Arduino Source Code") && - - Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, - DOC, "shell") && - Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, - DOC + "\\shell", "open") && - Registry.createKey(REGISTRY_ROOT_KEY.CLASSES_ROOT, - DOC + "\\shell\\open", "command") && - Registry.setStringValue(REGISTRY_ROOT_KEY.CLASSES_ROOT, - DOC + "\\shell\\open\\command", "", - openCommand)) { - // everything ok - // hooray! - - } else { - PreferencesData.setBoolean("platform.auto_file_type_associations", false); - } + private void recoverDefaultSketchbookFolder() throws IOException { + String path = getFolderPathFromRegistry("Personal"); + this.defaultSketchbookFolder = new File(path, "Arduino"); } + private String getFolderPathFromRegistry(String folderType) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Executor executor = new CollectStdOutExecutor(baos); - /** - * Find QuickTime for Java installation. - */ - protected void checkQuickTime() { - try { - String qtsystemPath = - Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE, - "Software\\Apple Computer, Inc.\\QuickTime", - "QTSysDir"); - // Could show a warning message here if QT not installed, but that - // would annoy people who don't want anything to do with QuickTime. - if (qtsystemPath != null) { - File qtjavaZip = new File(qtsystemPath, "QTJava.zip"); - if (qtjavaZip.exists()) { - String qtjavaZipPath = qtjavaZip.getAbsolutePath(); - String cp = System.getProperty("java.class.path"); - System.setProperty("java.class.path", - cp + File.pathSeparator + qtjavaZipPath); - } - } - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } + CommandLine toDevicePath = CommandLine.parse("reg query \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\" /v \"" + folderType + "\""); + executor.execute(toDevicePath); + return new RegQueryParser(new String(baos.toByteArray())).getValueOfKey(); } - - + /** * Remove extra quotes, slashes, and garbage from the Windows PATH. */ @@ -178,54 +103,15 @@ public class Platform extends processing.app.Platform { } } - - // looking for Documents and Settings/blah/Application Data/Processing - public File getSettingsFolder() throws Exception { - // HKEY_CURRENT_USER\Software\Microsoft - // \Windows\CurrentVersion\Explorer\Shell Folders - // Value Name: AppData - // Value Type: REG_SZ - // Value Data: path - - String keyPath = - "Software\\Microsoft\\Windows\\CurrentVersion" + - "\\Explorer\\Shell Folders"; - String appDataPath = - Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "AppData"); - - File dataFolder = new File(appDataPath, "Arduino15"); - return dataFolder; + public File getSettingsFolder() { + return settingsFolder; } - // looking for Documents and Settings/blah/My Documents/Processing - // (though using a reg key since it's different on other platforms) public File getDefaultSketchbookFolder() throws Exception { - - // http://support.microsoft.com/?kbid=221837&sd=RMVP - // http://support.microsoft.com/kb/242557/en-us - - // The path to the My Documents folder is stored in the following - // registry key, where path is the complete path to your storage location - - // HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders - // Value Name: Personal - // Value Type: REG_SZ - // Value Data: path - - // in some instances, this may be overridden by a policy, in which case check: - // HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders - - String keyPath = - "Software\\Microsoft\\Windows\\CurrentVersion" + - "\\Explorer\\Shell Folders"; - String personalPath = - Registry.getStringValue(REGISTRY_ROOT_KEY.CURRENT_USER, keyPath, "Personal"); - - return new File(personalPath, "Arduino"); + return defaultSketchbookFolder; } - public void openURL(String url) throws Exception { // this is not guaranteed to work, because who knows if the // path will always be c:\progra~1 et al. also if the user has diff --git a/arduino-core/src/processing/app/windows/RegQueryParser.java b/arduino-core/src/processing/app/windows/RegQueryParser.java new file mode 100644 index 000000000..d5b216281 --- /dev/null +++ b/arduino-core/src/processing/app/windows/RegQueryParser.java @@ -0,0 +1,35 @@ +package processing.app.windows; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; + +import java.util.Arrays; +import java.util.List; + +public class RegQueryParser { + + private String valueOfKey; + + public RegQueryParser(String regQueryOutput) { + parse(regQueryOutput); + } + + private void parse(String regQueryOutput) { + List rows = Arrays.asList(regQueryOutput.replace("\r", "\n").replace("\n\n", "\n").split("\n")); + + String row = Iterables.find(rows, new Predicate() { + @Override + public boolean apply(String input) { + return input.startsWith(" "); + } + }); + + String[] cols = row.split(" "); + assert cols.length == 4; + this.valueOfKey = cols[3]; + } + + public String getValueOfKey() { + return valueOfKey; + } +} diff --git a/arduino-core/src/processing/app/windows/Registry.java b/arduino-core/src/processing/app/windows/Registry.java deleted file mode 100644 index 71fa5eebe..000000000 --- a/arduino-core/src/processing/app/windows/Registry.java +++ /dev/null @@ -1,456 +0,0 @@ -package processing.app.windows; - -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.TreeMap; -import java.util.TreeSet; - -import com.sun.jna.ptr.IntByReference; - -/** - * Methods for accessing the Windows Registry. Only String and DWORD values supported at the moment. - */ -public class Registry { - public static enum REGISTRY_ROOT_KEY{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE, USERS}; - private final static HashMap rootKeyMap = new HashMap(); - - static { - rootKeyMap.put(REGISTRY_ROOT_KEY.CLASSES_ROOT, WINREG.HKEY_CLASSES_ROOT); - rootKeyMap.put(REGISTRY_ROOT_KEY.CURRENT_USER, WINREG.HKEY_CURRENT_USER); - rootKeyMap.put(REGISTRY_ROOT_KEY.LOCAL_MACHINE, WINREG.HKEY_LOCAL_MACHINE); - rootKeyMap.put(REGISTRY_ROOT_KEY.USERS, WINREG.HKEY_USERS); - } - - /** - * Testing. - * - * @param args arguments - * @throws java.lang.Exception on error - */ - public static void main(String[] args) throws Exception { - } - - /** - * Gets one of the root keys. - * - * @param key key type - * @return root key - */ - private static int getRegistryRootKey(REGISTRY_ROOT_KEY key) { - Advapi32 advapi32; - IntByReference pHandle; - int handle = 0; - - advapi32 = Advapi32.INSTANCE; - pHandle = new IntByReference(); - - if(advapi32.RegOpenKeyEx(rootKeyMap.get(key), null, 0, 0, pHandle) == WINERROR.ERROR_SUCCESS) { - handle = pHandle.getValue(); - } - return(handle); - } - - /** - * Opens a key. - * - * @param rootKey root key - * @param subKeyName name of the key - * @param access access mode - * @return handle to the key or 0 - */ - private static int openKey(REGISTRY_ROOT_KEY rootKey, String subKeyName, int access) { - Advapi32 advapi32; - IntByReference pHandle; - int rootKeyHandle; - - advapi32 = Advapi32.INSTANCE; - rootKeyHandle = getRegistryRootKey(rootKey); - pHandle = new IntByReference(); - - if(advapi32.RegOpenKeyEx(rootKeyHandle, subKeyName, 0, access, pHandle) == WINERROR.ERROR_SUCCESS) { - return(pHandle.getValue()); - - } else { - return(0); - } - } - - /** - * Converts a Windows buffer to a Java String. - * - * @param buf buffer - * @throws java.io.UnsupportedEncodingException on error - * @return String - */ - private static String convertBufferToString(byte[] buf) throws UnsupportedEncodingException { - return(new String(buf, 0, buf.length - 2, "UTF-16LE")); - } - - /** - * Converts a Windows buffer to an int. - * - * @param buf buffer - * @return int - */ - private static int convertBufferToInt(byte[] buf) { - return(((int)(buf[0] & 0xff)) + (((int)(buf[1] & 0xff)) << 8) + (((int)(buf[2] & 0xff)) << 16) + (((int)(buf[3] & 0xff)) << 24)); - } - - /** - * Read a String value. - * - * @param rootKey root key - * @param subKeyName key name - * @param name value name - * @throws java.io.UnsupportedEncodingException on error - * @return String or null - */ - public static String getStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) throws UnsupportedEncodingException { - Advapi32 advapi32; - IntByReference pType, lpcbData; - byte[] lpData = new byte[1]; - int handle = 0; - String ret = null; - - advapi32 = Advapi32.INSTANCE; - pType = new IntByReference(); - lpcbData = new IntByReference(); - handle = openKey(rootKey, subKeyName, WINNT.KEY_READ); - - if(handle != 0) { - - if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) { - lpData = new byte[lpcbData.getValue()]; - - if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) { - ret = convertBufferToString(lpData); - } - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Read an int value. - * - * - * @return int or 0 - * @param rootKey root key - * @param subKeyName key name - * @param name value name - */ - public static int getIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) { - Advapi32 advapi32; - IntByReference pType, lpcbData; - byte[] lpData = new byte[1]; - int handle = 0; - int ret = 0; - - advapi32 = Advapi32.INSTANCE; - pType = new IntByReference(); - lpcbData = new IntByReference(); - handle = openKey(rootKey, subKeyName, WINNT.KEY_READ); - - if(handle != 0) { - - if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) { - lpData = new byte[lpcbData.getValue()]; - - if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) { - ret = convertBufferToInt(lpData); - } - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Delete a value. - * - * @param rootKey root key - * @param subKeyName key name - * @param name value name - * @return true on success - */ - public static boolean deleteValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) { - Advapi32 advapi32; - int handle; - boolean ret = true; - - advapi32 = Advapi32.INSTANCE; - - handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE); - - if(handle != 0) { - if(advapi32.RegDeleteValue(handle, name) == WINERROR.ERROR_SUCCESS) { - ret = true; - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Writes a String value. - * - * @param rootKey root key - * @param subKeyName key name - * @param name value name - * @param value value - * @throws java.io.UnsupportedEncodingException on error - * @return true on success - */ - public static boolean setStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, String value) throws UnsupportedEncodingException { - Advapi32 advapi32; - int handle; - byte[] data; - boolean ret = false; - - // appears to be Java 1.6 syntax, removing [fry] - //data = Arrays.copyOf(value.getBytes("UTF-16LE"), value.length() * 2 + 2); - data = new byte[value.length() * 2 + 2]; - byte[] src = value.getBytes("UTF-16LE"); - System.arraycopy(src, 0, data, 0, src.length); - - advapi32 = Advapi32.INSTANCE; - handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE); - - if(handle != 0) { - if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_SZ, data, data.length) == WINERROR.ERROR_SUCCESS) { - ret = true; - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Writes an int value. - * - * - * @return true on success - * @param rootKey root key - * @param subKeyName key name - * @param name value name - * @param value value - */ - public static boolean setIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, int value) { - Advapi32 advapi32; - int handle; - byte[] data; - boolean ret = false; - - data = new byte[4]; - data[0] = (byte)(value & 0xff); - data[1] = (byte)((value >> 8) & 0xff); - data[2] = (byte)((value >> 16) & 0xff); - data[3] = (byte)((value >> 24) & 0xff); - advapi32 = Advapi32.INSTANCE; - handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE); - - if(handle != 0) { - - if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_DWORD, data, data.length) == WINERROR.ERROR_SUCCESS) { - ret = true; - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Check for existence of a value. - * - * @param rootKey root key - * @param subKeyName key name - * @param name value name - * @return true if exists - */ - public static boolean valueExists(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) { - Advapi32 advapi32; - IntByReference pType, lpcbData; - byte[] lpData = new byte[1]; - int handle = 0; - boolean ret = false; - - advapi32 = Advapi32.INSTANCE; - pType = new IntByReference(); - lpcbData = new IntByReference(); - handle = openKey(rootKey, subKeyName, WINNT.KEY_READ); - - if(handle != 0) { - - if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) != WINERROR.ERROR_FILE_NOT_FOUND) { - ret = true; - - } else { - ret = false; - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Create a new key. - * - * @param rootKey root key - * @param parent name of parent key - * @param name key name - * @return true on success - */ - public static boolean createKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) { - Advapi32 advapi32; - IntByReference hkResult, dwDisposition; - int handle = 0; - boolean ret = false; - - advapi32 = Advapi32.INSTANCE; - hkResult = new IntByReference(); - dwDisposition = new IntByReference(); - handle = openKey(rootKey, parent, WINNT.KEY_READ); - - if(handle != 0) { - - if(advapi32.RegCreateKeyEx(handle, name, 0, null, WINNT.REG_OPTION_NON_VOLATILE, WINNT.KEY_READ, null, - hkResult, dwDisposition) == WINERROR.ERROR_SUCCESS) { - ret = true; - advapi32.RegCloseKey(hkResult.getValue()); - - } else { - ret = false; - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Delete a key. - * - * @param rootKey root key - * @param parent name of parent key - * @param name key name - * @return true on success - */ - public static boolean deleteKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) { - Advapi32 advapi32; - int handle = 0; - boolean ret = false; - - advapi32 = Advapi32.INSTANCE; - handle = openKey(rootKey, parent, WINNT.KEY_READ); - - if(handle != 0) { - - if(advapi32.RegDeleteKey(handle, name) == WINERROR.ERROR_SUCCESS) { - ret = true; - - } else { - ret = false; - } - advapi32.RegCloseKey(handle); - } - return(ret); - } - - /** - * Get all sub keys of a key. - * - * @param rootKey root key - * @param parent key name - * @return array with all sub key names - */ - public static String[] getSubKeys(REGISTRY_ROOT_KEY rootKey, String parent) { - Advapi32 advapi32; - int handle = 0, dwIndex; - char[] lpName; - IntByReference lpcName; - WINBASE.FILETIME lpftLastWriteTime; - TreeSet subKeys = new TreeSet(); - - advapi32 = Advapi32.INSTANCE; - handle = openKey(rootKey, parent, WINNT.KEY_READ); - lpName = new char[256]; - lpcName = new IntByReference(256); - lpftLastWriteTime = new WINBASE.FILETIME(); - - if(handle != 0) { - dwIndex = 0; - - while(advapi32.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null, - null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) { - subKeys.add(new String(lpName, 0, lpcName.getValue())); - lpcName.setValue(256); - dwIndex++; - } - advapi32.RegCloseKey(handle); - } - - return(subKeys.toArray(new String[]{})); - } - - /** - * Get all values under a key. - * - * @param rootKey root key - * @param key jey name - * @throws java.io.UnsupportedEncodingException on error - * @return TreeMap with name and value pairs - */ - public static TreeMap getValues(REGISTRY_ROOT_KEY rootKey, String key) throws UnsupportedEncodingException { - Advapi32 advapi32; - int handle = 0, dwIndex, result = 0; - char[] lpValueName; - byte[] lpData; - IntByReference lpcchValueName, lpType, lpcbData; - String name; - TreeMap values = new TreeMap(String.CASE_INSENSITIVE_ORDER); - - advapi32 = Advapi32.INSTANCE; - handle = openKey(rootKey, key, WINNT.KEY_READ); - lpValueName = new char[16384]; - lpcchValueName = new IntByReference(16384); - lpType = new IntByReference(); - lpData = new byte[1]; - lpcbData = new IntByReference(); - - if(handle != 0) { - dwIndex = 0; - - do { - lpcbData.setValue(0); - result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null, - lpType, lpData, lpcbData); - - if(result == WINERROR.ERROR_MORE_DATA) { - lpData = new byte[lpcbData.getValue()]; - lpcchValueName = new IntByReference(16384); - result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null, - lpType, lpData, lpcbData); - - if(result == WINERROR.ERROR_SUCCESS) { - name = new String(lpValueName, 0, lpcchValueName.getValue()); - - switch(lpType.getValue()) { - case WINNT.REG_SZ: - values.put(name, convertBufferToString(lpData)); - break; - case WINNT.REG_DWORD: - values.put(name, convertBufferToInt(lpData)); - break; - default: - break; - } - } - } - dwIndex++; - } while(result == WINERROR.ERROR_SUCCESS); - - advapi32.RegCloseKey(handle); - } - return(values); - } -} diff --git a/arduino-core/src/processing/app/windows/WINBASE.java b/arduino-core/src/processing/app/windows/WINBASE.java deleted file mode 100644 index 78a386f04..000000000 --- a/arduino-core/src/processing/app/windows/WINBASE.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * WINBASE.java - * - * Created on 5. September 2007, 11:24 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package processing.app.windows; - -import com.sun.jna.Pointer; -import com.sun.jna.Structure; - -/** - * - * @author TB - */ -public interface WINBASE { -/* -typedef struct _SECURITY_ATTRIBUTES { - DWORD nLength; - LPVOID lpSecurityDescriptor; - BOOL bInheritHandle; -} SECURITY_ATTRIBUTES, - *PSECURITY_ATTRIBUTES, - *LPSECURITY_ATTRIBUTES;*/ - public static class SECURITY_ATTRIBUTES extends Structure { - public int nLength; - public Pointer lpSecurityDescriptor; - public boolean bInheritHandle; - } - -/* -typedef struct _FILETIME { - DWORD dwLowDateTime; - DWORD dwHighDateTime; -} FILETIME, *PFILETIME, *LPFILETIME;*/ - public static class FILETIME extends Structure { - public int dwLowDateTime; - public int dwHighDateTime; - } -} diff --git a/arduino-core/src/processing/app/windows/WINERROR.java b/arduino-core/src/processing/app/windows/WINERROR.java deleted file mode 100644 index a9382cfcb..000000000 --- a/arduino-core/src/processing/app/windows/WINERROR.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * WINERROR.java - * - * Created on 7. August 2007, 08:09 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package processing.app.windows; - - -/** - * - * @author TB - */ -public interface WINERROR { - public final static int ERROR_SUCCESS = 0; - public final static int NO_ERROR = 0; - public final static int ERROR_FILE_NOT_FOUND = 2; - public final static int ERROR_MORE_DATA = 234; -} diff --git a/arduino-core/src/processing/app/windows/WINNT.java b/arduino-core/src/processing/app/windows/WINNT.java deleted file mode 100644 index c08c9f5a3..000000000 --- a/arduino-core/src/processing/app/windows/WINNT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * WINNT.java - * - * Created on 8. August 2007, 13:41 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package processing.app.windows; - -/** - * - * @author TB - */ -public interface WINNT { - public final static int DELETE = 0x00010000; - public final static int READ_CONTROL = 0x00020000; - public final static int WRITE_DAC = 0x00040000; - public final static int WRITE_OWNER = 0x00080000; - public final static int SYNCHRONIZE = 0x00100000; - - public final static int STANDARD_RIGHTS_REQUIRED = 0x000F0000; - - public final static int STANDARD_RIGHTS_READ = READ_CONTROL; - public final static int STANDARD_RIGHTS_WRITE = READ_CONTROL; - public final static int STANDARD_RIGHTS_EXECUTE = READ_CONTROL; - - public final static int STANDARD_RIGHTS_ALL = 0x001F0000; - - public final static int SPECIFIC_RIGHTS_ALL = 0x0000FFFF; - - public final static int GENERIC_EXECUTE = 0x20000000; - - public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010; - - public final static int KEY_QUERY_VALUE = 0x0001; - public final static int KEY_SET_VALUE = 0x0002; - public final static int KEY_CREATE_SUB_KEY = 0x0004; - public final static int KEY_ENUMERATE_SUB_KEYS = 0x0008; - public final static int KEY_NOTIFY = 0x0010; - public final static int KEY_CREATE_LINK = 0x0020; - - public final static int KEY_READ = ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE)); - public final static int KEY_WRITE = ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE)); - - public final static int REG_NONE = 0; // No value type - public final static int REG_SZ = 1; // Unicode nul terminated string - public final static int REG_EXPAND_SZ = 2; // Unicode nul terminated string - // (with environment variable references) - public final static int REG_BINARY = 3; // Free form binary - public final static int REG_DWORD = 4; // 32-bit number - public final static int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD) - public final static int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number - public final static int REG_LINK = 6; // Symbolic Link (unicode) - public final static int REG_MULTI_SZ = 7; // Multiple Unicode strings - public final static int REG_RESOURCE_LIST = 8; // Resource list in the resource map - public final static int REG_FULL_RESOURCE_DESCRIPTOR = 9; // Resource list in the hardware description - public final static int REG_RESOURCE_REQUIREMENTS_LIST = 10; - - public final static int REG_OPTION_RESERVED = 0x00000000; // Parameter is reserved - public final static int REG_OPTION_NON_VOLATILE = 0x00000000; // Key is preserved - // when system is rebooted - public final static int REG_OPTION_VOLATILE = 0x00000001; // Key is not preserved - // when system is rebooted - public final static int REG_OPTION_CREATE_LINK = 0x00000002; // Created key is a - // symbolic link - public final static int REG_OPTION_BACKUP_RESTORE = 0x00000004; // open for backup or restore - // special access rules - // privilege required - public final static int REG_OPTION_OPEN_LINK = 0x00000008; // Open symbolic link - -} diff --git a/arduino-core/src/processing/app/windows/WINREG.java b/arduino-core/src/processing/app/windows/WINREG.java deleted file mode 100644 index 07a7c23cb..000000000 --- a/arduino-core/src/processing/app/windows/WINREG.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * WINREG.java - * - * Created on 17. August 2007, 14:32 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package processing.app.windows; - -/** - * - * @author TB - */ -public interface WINREG { - public final static int HKEY_CLASSES_ROOT = 0x80000000; - public final static int HKEY_CURRENT_USER = 0x80000001; - public final static int HKEY_LOCAL_MACHINE = 0x80000002; - public final static int HKEY_USERS = 0x80000003; -} diff --git a/build/.editorconfig b/build/.editorconfig new file mode 100644 index 000000000..bd8c8987e --- /dev/null +++ b/build/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +charset = utf-8 + +[*.{md,adoc}] +indent_style = space +trim_trailing_whitespace = false diff --git a/build/cmd/dist.sh b/build/cmd/dist.sh index 38d295365..7298197c5 100755 --- a/build/cmd/dist.sh +++ b/build/cmd/dist.sh @@ -26,7 +26,6 @@ cp -r ../shared/lib processing/ cp -r ../shared/libraries processing/ cp ../../app/lib/antlr.jar processing/lib/ cp ../../app/lib/ecj.jar processing/lib/ -cp ../../app/lib/jna.jar processing/lib/ cp ../shared/revisions.txt processing/ # add the libraries folder with source diff --git a/build/javadoc/make.sh b/build/javadoc/make.sh index 1dbc46ce6..0b31b88e8 100755 --- a/build/javadoc/make.sh +++ b/build/javadoc/make.sh @@ -9,7 +9,7 @@ javadoc -public -notimestamp -d core \ # setting this up right, so if anyone knows how to do it without specifying # all the directories like this, please let us know. javadoc -public -notimestamp -d everything \ - -classpath ../../app/lib/antlr.jar:../../app/lib/jna.jar:../../serial/library/jssc-2.6.0.jar:../../opengl/library/jogl.jar:../../pdf/library/itext.jar:../../app/lib/ecj.jar \ + -classpath ../../app/lib/antlr.jar:../../serial/library/jssc-2.6.0.jar:../../opengl/library/jogl.jar:../../pdf/library/itext.jar:../../app/lib/ecj.jar \ ../../core/src/processing/core/*.java \ ../../core/src/processing/xml/*.java \ ../../app/src/antlr/*.java \ diff --git a/build/macosx/template.app/Contents/Info.plist b/build/macosx/template.app/Contents/Info.plist index 6d49f00a5..5fa1337eb 100755 --- a/build/macosx/template.app/Contents/Info.plist +++ b/build/macosx/template.app/Contents/Info.plist @@ -97,7 +97,7 @@ - $JAVAROOT/antlr.jar:$JAVAROOT/apple.jar:$JAVAROOT/arduino-core.jar:$JAVAROOT/bcpg-jdk15on-152.jar:$JAVAROOT/bcprov-jdk15on-152.jar:$JAVAROOT/commons-codec-1.7.jar:$JAVAROOT/commons-compress-1.8.jar:$JAVAROOT/commons-exec-1.1.jar:$JAVAROOT/commons-httpclient-3.1.jar:$JAVAROOT/commons-lang3-3.3.2.jar:$JAVAROOT/commons-logging-1.0.4.jar:$JAVAROOT/ecj.jar:$JAVAROOT/guava-18.0.jar:$JAVAROOT/jackson-annotations-2.2.3.jar:$JAVAROOT/jackson-core-2.2.3.jar:$JAVAROOT/jackson-databind-2.2.3.jar:$JAVAROOT/jackson-module-mrbean-2.2.3.jar:$JAVAROOT/java-semver-0.8.0.jar:$JAVAROOT/jmdns-3.4.1.jar:$JAVAROOT/jna.jar:$JAVAROOT/jsch-0.1.50.jar:$JAVAROOT/jssc-2.8.0.jar:$JAVAROOT/pde.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/rsyntaxtextarea-2.5.6.1+arduino.jar + $JAVAROOT/antlr.jar:$JAVAROOT/apple.jar:$JAVAROOT/arduino-core.jar:$JAVAROOT/bcpg-jdk15on-152.jar:$JAVAROOT/bcprov-jdk15on-152.jar:$JAVAROOT/commons-codec-1.7.jar:$JAVAROOT/commons-compress-1.8.jar:$JAVAROOT/commons-exec-1.1.jar:$JAVAROOT/commons-httpclient-3.1.jar:$JAVAROOT/commons-lang3-3.3.2.jar:$JAVAROOT/commons-logging-1.0.4.jar:$JAVAROOT/ecj.jar:$JAVAROOT/guava-18.0.jar:$JAVAROOT/jackson-annotations-2.2.3.jar:$JAVAROOT/jackson-core-2.2.3.jar:$JAVAROOT/jackson-databind-2.2.3.jar:$JAVAROOT/jackson-module-mrbean-2.2.3.jar:$JAVAROOT/java-semver-0.8.0.jar:$JAVAROOT/jmdns-3.4.1.jar:$JAVAROOT/jsch-0.1.50.jar:$JAVAROOT/jssc-2.8.0.jar:$JAVAROOT/pde.jar:$JAVAROOT/quaqua.jar:$JAVAROOT/rsyntaxtextarea-2.5.6.1+arduino.jar JVMArchs diff --git a/build/windows/launcher/config.xml b/build/windows/launcher/config.xml index c0cd5c751..d14e7f13d 100644 --- a/build/windows/launcher/config.xml +++ b/build/windows/launcher/config.xml @@ -34,7 +34,6 @@ lib/jackson-module-mrbean-2.2.3.jar lib/java-semver-0.8.0.jar lib/jmdns-3.4.1.jar - lib/jna.jar lib/jsch-0.1.50.jar lib/jssc-2.8.0.jar lib/pde.jar @@ -45,7 +44,6 @@ 32 -splash:./lib/splash.png -Dsun.java2d.d3d=false - -Djna.nosys=true An error occurred while starting the application. diff --git a/build/windows/launcher/config_debug.xml b/build/windows/launcher/config_debug.xml index 5212655e1..5c92f8309 100644 --- a/build/windows/launcher/config_debug.xml +++ b/build/windows/launcher/config_debug.xml @@ -34,7 +34,6 @@ lib/jackson-module-mrbean-2.2.3.jar lib/java-semver-0.8.0.jar lib/jmdns-3.4.1.jar - lib/jna.jar lib/jsch-0.1.50.jar lib/jssc-2.8.0.jar lib/pde.jar @@ -44,7 +43,6 @@ java 32 -Dsun.java2d.d3d=false - -Djna.nosys=true An error occurred while starting the application.