Moving the platform modules into their own subdirectory to lower the clutter in the root
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bef2334
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,103 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+# NOCDDL
+
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+
+# build
+build: .build-post
+
+.build-pre: .build-pre-$(CONF)
+# Add your pre 'build' code here...
+
+.build-pre-app.exe: app.rc
+ windres -oapp.res -Ocoff app.rc
+
+.build-pre-app64.exe: app.rc
+ x86_64-w64-mingw32-windres.exe -oapp64.res -Ocoff app.rc
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
diff --git a/app.cpp b/app.cpp
new file mode 100644
index 0000000..840c828
--- /dev/null
+++ b/app.cpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+
+#include "applauncher.h"
+
+int main(int argc, char *argv[]) {
+ AppLauncher launcher;
+ return launcher.start(argc - 1, argv + 1);
+}
diff --git a/app.ico b/app.ico
new file mode 100644
index 0000000..294cd70
--- /dev/null
+++ b/app.ico
Binary files differ
diff --git a/app.rc b/app.rc
new file mode 100644
index 0000000..345b1a5
--- /dev/null
+++ b/app.rc
@@ -0,0 +1,22 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+
+100 ICON "app.ico"
+
diff --git a/applauncher.cpp b/applauncher.cpp
new file mode 100644
index 0000000..02ed481
--- /dev/null
+++ b/applauncher.cpp
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+#include "applauncher.h"
+#include "../../o.n.bootstrap/launcher/windows/utilsfuncs.h"
+#include "../../o.n.bootstrap/launcher/windows/argnames.h"
+
+using namespace std;
+
+const char *AppLauncher::OPT_DEFAULT_USER_DIR = "default_userdir=";
+const char *AppLauncher::OPT_DEFAULT_CACHE_DIR = "default_cachedir=";
+const char *AppLauncher::OPT_DEFAULT_OPTIONS = "default_options=";
+const char *AppLauncher::OPT_EXTRA_CLUSTERS = "extra_clusters=";
+const char *AppLauncher::OPT_JDK_HOME = "jdkhome=";
+const char *AppLauncher::APPNAME_TOKEN = "${APPNAME}";
+
+AppLauncher::AppLauncher() {
+}
+
+AppLauncher::AppLauncher(const AppLauncher& orig) {
+}
+
+AppLauncher::~AppLauncher() {
+}
+
+bool AppLauncher::initBaseNames() {
+ if (!NbLauncher::initBaseNames()) {
+ return false;
+ }
+
+ string pattern = baseDir + "\\platform*";
+ WIN32_FIND_DATA fd = {0};
+ HANDLE hFind;
+ hFind = FindFirstFile(pattern.c_str(), &fd);
+ if (hFind == INVALID_HANDLE_VALUE) {
+ logErr(false, true, "Cannot find 'platform*' folder!");
+ return false;
+ }
+
+ do {
+ if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ && fileExists((baseDir + '\\' + fd.cFileName + NbLauncher::NBEXEC_FILE_PATH).c_str())) {
+ platformDir = baseDir + '\\' + fd.cFileName;
+ break;
+ }
+ } while (FindNextFile(hFind, &fd));
+
+ FindClose(hFind);
+
+ if (platformDir.empty()) {
+ logErr(false, true, "Cannot find valid 'platform*' folder!");
+ return false;
+ }
+ return true;
+}
+
+bool AppLauncher::findUserDir(const char *str) {
+ logMsg("AppLauncher::findUserDir()");
+ if (strncmp(str, HOME_TOKEN, strlen(HOME_TOKEN)) == 0) {
+ if (userHome.empty()) {
+ TCHAR userHomeChar[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, userHomeChar))) {
+ return false;
+ }
+ userHome = userHomeChar;
+ logMsg("User home: %s", userHome.c_str());
+ }
+ str += strlen(HOME_TOKEN);
+ userDir = userHome;
+ }
+ const char *appToken = strstr(str, APPNAME_TOKEN);
+ if (appToken) {
+ userDir += string(str, appToken - str);
+ str += appToken - str;
+ userDir += appName;
+ str += strlen(APPNAME_TOKEN);
+ }
+ userDir += str;
+ return true;
+}
+
+bool AppLauncher::findCacheDir(const char *str) {
+ logMsg("AppLauncher::findCacheDir");
+ if (strncmp(str, HOME_TOKEN, strlen(HOME_TOKEN)) == 0) {
+ if (userHome.empty()) {
+ TCHAR userHomeChar[MAX_PATH];
+ if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, userHomeChar))) {
+ return false;
+ }
+ userHome = userHomeChar;
+ logMsg("User home: %s", userHome.c_str());
+ }
+ str += strlen(HOME_TOKEN);
+ cacheDir = userHome;
+ }
+ const char *appToken = strstr(str, APPNAME_TOKEN);
+ if (appToken) {
+ cacheDir += string(str, appToken - str);
+ str += appToken - str;
+ cacheDir += appName;
+ str += strlen(APPNAME_TOKEN);
+ }
+ cacheDir += str;
+ return true;
+}
+
+const char * AppLauncher::getAppName() {
+ return appName.c_str();
+}
+
+void AppLauncher::addSpecificOptions(CmdArgs &args) {
+}
+
+void AppLauncher::adjustHeapSize() {
+}
+
+const char * AppLauncher::getDefUserDirOptName() {
+ return OPT_DEFAULT_USER_DIR;
+}
+
+const char * AppLauncher::getDefCacheDirOptName() {
+ return OPT_DEFAULT_CACHE_DIR;
+}
+
+const char * AppLauncher::getDefOptionsOptName() {
+ return OPT_DEFAULT_OPTIONS;
+}
+
+const char * AppLauncher::getExtraClustersOptName() {
+ return OPT_EXTRA_CLUSTERS;
+}
+
+const char * AppLauncher::getJdkHomeOptName() {
+ return OPT_JDK_HOME;
+}
+
+const char * AppLauncher::getCurrentDir() {
+ return baseDir.c_str();
+}
diff --git a/applauncher.h b/applauncher.h
new file mode 100644
index 0000000..eb554c4
--- /dev/null
+++ b/applauncher.h
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ /*
+ * Author: Tomas Holy
+ */
+
+#ifndef _APPLAUNCHER_H
+#define _APPLAUNCHER_H
+
+#include <string>
+#include <windows.h>
+
+#include "shlobj.h"
+#include "../../ide/launcher/windows/nblauncher.h"
+
+class AppLauncher : public NbLauncher {
+
+ static const char *OPT_DEFAULT_USER_DIR;
+ static const char *OPT_DEFAULT_CACHE_DIR;
+ static const char *OPT_DEFAULT_OPTIONS;
+ static const char *OPT_EXTRA_CLUSTERS;
+ static const char *OPT_JDK_HOME;
+ static const char *APPNAME_TOKEN;
+ static const char *REG_APPDATA_NAME;
+
+public:
+ AppLauncher();
+ virtual ~AppLauncher();
+
+protected:
+ virtual bool initBaseNames();
+ virtual const char * getAppName();
+ virtual void addSpecificOptions(CmdArgs &args);
+ virtual void adjustHeapSize();
+ virtual bool findUserDir(const char *str);
+ virtual bool findCacheDir(const char *str);
+ virtual const char * getDefUserDirOptName();
+ virtual const char * getDefCacheDirOptName();
+ virtual const char * getDefOptionsOptName();
+ virtual const char * getExtraClustersOptName();
+ virtual const char * getJdkHomeOptName();
+ virtual const char * getCurrentDir();
+
+private:
+ AppLauncher(const AppLauncher& orig);
+};
+
+#endif /* _NBLAUNCHER_H */
+
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
new file mode 100644
index 0000000..6738d4d
--- /dev/null
+++ b/nbproject/configurations.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<configurationDescriptor version="84">
+ <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
+ <logicalFolder name="HeaderFiles"
+ displayName="Header Files"
+ projectFiles="true">
+ <itemPath>applauncher.h</itemPath>
+ <itemPath>../../ide/launcher/windows/nblauncher.h</itemPath>
+ <itemPath>../../o.n.bootstrap/launcher/windows/utilsfuncs.h</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ResourceFiles"
+ displayName="Resource Files"
+ projectFiles="true">
+ </logicalFolder>
+ <logicalFolder name="SourceFiles"
+ displayName="Source Files"
+ projectFiles="true">
+ <itemPath>app.cpp</itemPath>
+ <itemPath>applauncher.cpp</itemPath>
+ <itemPath>../../ide/launcher/windows/nblauncher.cpp</itemPath>
+ <itemPath>../../o.n.bootstrap/launcher/windows/utilsfuncs.cpp</itemPath>
+ </logicalFolder>
+ <logicalFolder name="ExternalFiles"
+ displayName="Important Files"
+ projectFiles="false">
+ <itemPath>Makefile</itemPath>
+ </logicalFolder>
+ </logicalFolder>
+ <projectmakefile>Makefile</projectmakefile>
+ <confs>
+ <conf name="app.exe" type="1">
+ <toolsSet>
+ <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
+ <compilerSet>Cygwin|Cygwin</compilerSet>
+ </toolsSet>
+ <compileType>
+ <cTool>
+ <developmentMode>5</developmentMode>
+ </cTool>
+ <ccTool>
+ <developmentMode>5</developmentMode>
+ <architecture>1</architecture>
+ <commandLine>-mno-cygwin</commandLine>
+ <preprocessorList>
+ <Elem>ARCHITECTURE=32</Elem>
+ <Elem>NBEXEC_DLL="/lib/nbexec.dll"</Elem>
+ </preprocessorList>
+ </ccTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <output>../release/launchers/app.exe</output>
+ <linkerLibItems>
+ <linkerOptionItem>app.res</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-mwindows</commandLine>
+ </linkerTool>
+ </compileType>
+ </conf>
+ <conf name="app64.exe" type="1">
+ <toolsSet>
+ <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
+ <compilerSet>Cygwin64|Cygwin</compilerSet>
+ </toolsSet>
+ <compileType>
+ <cTool>
+ <developmentMode>5</developmentMode>
+ </cTool>
+ <ccTool>
+ <developmentMode>5</developmentMode>
+ <architecture>2</architecture>
+ <commandLine>-mno-cygwin -static-libgcc -static-libstdc++</commandLine>
+ <preprocessorList>
+ <Elem>ARCHITECTURE=64</Elem>
+ <Elem>NBEXEC_DLL="/lib/nbexec64.dll"</Elem>
+ </preprocessorList>
+ </ccTool>
+ <fortranCompilerTool>
+ <developmentMode>5</developmentMode>
+ </fortranCompilerTool>
+ <linkerTool>
+ <output>../release/launchers/app64.exe</output>
+ <linkerLibItems>
+ <linkerOptionItem>app64.res</linkerOptionItem>
+ </linkerLibItems>
+ <commandLine>-mwindows</commandLine>
+ </linkerTool>
+ </compileType>
+ </conf>
+ </confs>
+</configurationDescriptor>
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..2456923
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..34dd422
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.cnd.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>Platform App Launcher Win</name>
+ <make-project-type>0</make-project-type>
+ <c-extensions/>
+ <cpp-extensions>cpp</cpp-extensions>
+ <header-extensions>h</header-extensions>
+ <sourceEncoding>UTF-8</sourceEncoding>
+ <make-dep-projects/>
+ <sourceRootList/>
+ <confList>
+ <confElem>
+ <name>app.exe</name>
+ <type>1</type>
+ </confElem>
+ <confElem>
+ <name>app64.exe</name>
+ <type>1</type>
+ </confElem>
+ </confList>
+ </data>
+ </configuration>
+</project>