Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions harness/apisupport.harness/release/etc/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,23 @@
# specific language governing permissions and limitations
# under the License.

# ${HOME} will be replaced by user home directory according to platform.
#
# Default locations of userdir and cachedir:
# (http://wiki.netbeans.org/FaqWhatIsUserdir)
#
# The following variables can be used for these options:
# - default_userdir
# - default_cachedir
# - default_options
# - jdkhome
#
# On Windows ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with <AppData>\<AppName>, where <AppData> is the value of
# "AppData" key in Windows Registry under
# with "<AppData>\<AppName>", where <AppData> is users value of "AppData" key
# in Windows Registry under
# "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
# and ${DEFAULT_CACHEDIR_ROOT} will be replaced by the launcher
# with the value of "<LocalAppData>\<AppName>\Cache" where "LocalAppData"
# is a key in Windows Registry under
# is a key in Windows Registry under
# "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders".
# <AppName> is the the executable's filename without the extension.
#
Expand All @@ -36,22 +41,21 @@
# where <AppName> is the launcher script's name.
#
# On other systems ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with "${HOME}/.<AppName>" and ${DEFAULT_CACHEDIR_ROOT} with
# with "${HOME}/.<AppName>" and ${DEFAULT_CACHEDIR_ROOT} with
# "${HOME}/.cache/<AppName>".
#
# You can also use ${HOME} variable which will be replaced with
# user.home JVM system property value.
#
# The above location variables are valid only in the default_userdir and
# default_cachedir properties.
#
# NOTE: If you specify a non-default userdir path on command line
# (--userdir option) and don't specify a cachedir path (--cachedir option),
# cachedir will be in "<userdir>/var/cache".
#
# Cachedir must be different from userdir. The same cachedir and userdir
# would cause problems.
#
# ${BASEDIR} is replaced with the base directory of the NetBeans installation
#

default_userdir="${DEFAULT_USERDIR_ROOT}/dev"
default_cachedir="${DEFAULT_CACHEDIR_ROOT}/dev"
Expand Down
12 changes: 10 additions & 2 deletions harness/apisupport.harness/release/launchers/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ while [ -h "$PRG" ]; do
done

progdir=`dirname "$PRG"`
old=`pwd`
cd "$progdir"/..
basedir=`pwd`
cd "$old"

APPNAME=`basename "$PRG"`
if [ -z "$APP_DOCK_NAME" ] ; then
APP_DOCK_NAME="$APPNAME"
Expand All @@ -52,8 +57,11 @@ case "`uname`" in
;;
esac

if [ -f "$progdir/../etc/$APPNAME".conf ] ; then
. "$progdir/../etc/$APPNAME".conf
# $HOME can be used as it is present on mac OS and linux
BASEDIR=$basedir

if [ -f "$basedir/etc/$APPNAME".conf ] ; then
. "$basedir/etc/$APPNAME".conf
fi

# XXX does not correctly deal with spaces in non-userdir params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="101.1.0.0"
<assemblyIdentity version="101.3.0.0"
processorArchitecture="x86"
name="app.exe"
type="win32"/>
Expand Down
20 changes: 15 additions & 5 deletions nb/ide.launcher/netbeans.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#
# Default locations of userdir and cachedir:
# (http://wiki.netbeans.org/FaqWhatIsUserdir)
#
# The following variables can be used for these options:
# - netbeans_default_userdir
# - netbeans_default_cachedir
# - netbeans_default_options
# - netbeans_jdkhome
#
# On Windows ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with "<AppData>\NetBeans" where <AppData> is user's
# value of "AppData" key in Windows Registry under
# with "<AppData>\NetBeans", where <AppData> is users value of "AppData" key
# in Windows Registry under
# "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
# and ${DEFAULT_CACHEDIR_ROOT} will be replaced by the launcher
# with "<Local AppData>\NetBeans\Cache" where <Local AppData> is user's
Expand All @@ -32,11 +39,11 @@
# ${DEFAULT_CACHEDIR_ROOT} with "~/Library/Caches/NetBeans"
#
# On other systems ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with "~/.netbeans" and ${DEFAULT_CACHEDIR_ROOT} with "~/.cache/netbeans"
# with "${HOME}/.netbeans" and ${DEFAULT_CACHEDIR_ROOT} with
# "${HOME}/.cache/netbeans".
#
# You can also use ${HOME} variable which will be replaced with
# user.home JVM system property value. This variable is valid only in
# netbeans_default_userdir and netbeans_default_cachedir properties.
# user.home JVM system property value.
#
# NOTE: If you specify a non-default userdir path on command line
# (--userdir option) and don't specify a cachedir path (--cachedir option),
Expand All @@ -45,6 +52,9 @@
# Cachedir must be different from userdir. The same cachedir and userdir
# would cause problems.
#
# ${BASEDIR} is replaced with the base directory of the NetBeans installation
#

netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/@@metabuild.RawVersion@@"
netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/@@metabuild.RawVersion@@"

Expand Down
2 changes: 2 additions & 0 deletions nb/ide.launcher/unix/netbeans
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ case "`uname`" in
;;
esac

# $HOME can be used as it is present on mac OS and
BASEDIR=$basedir

if [ -f "$basedir"/etc/netbeans.conf ] ; then
. "$basedir"/etc/netbeans.conf
Expand Down
115 changes: 59 additions & 56 deletions nb/ide.launcher/windows/nblauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const char *NbLauncher::ENV_USER_PROFILE = "USERPROFILE";
const char *NbLauncher::HOME_TOKEN = "${HOME}";
const char *NbLauncher::DEFAULT_USERDIR_ROOT_TOKEN = "${DEFAULT_USERDIR_ROOT}";
const char *NbLauncher::DEFAULT_CACHEDIR_ROOT_TOKEN = "${DEFAULT_CACHEDIR_ROOT}";
const char *NbLauncher::BASEDIR_TOKEN = "${BASEDIR}";
const char *NbLauncher::NETBEANS_DIRECTORY = "\\NetBeans\\";
const char *NbLauncher::NETBEANS_CACHES_DIRECTORY = "\\NetBeans\\Cache\\";

Expand Down Expand Up @@ -214,6 +215,11 @@ bool NbLauncher::initBaseNames() {
baseDir = path;

logMsg("Base dir: %s", baseDir.c_str());

getDefaultUserDirRoot();
getDefaultCacheDirRoot();
getUserHome();

return true;
}

Expand Down Expand Up @@ -365,83 +371,77 @@ bool NbLauncher::parseArgs(int argc, char *argv[]) {
}

bool NbLauncher::findUserDir(const char *str) {
logMsg("NbLauncher::findUserDir()");
if (strncmp(str, HOME_TOKEN, strlen(HOME_TOKEN)) == 0) {
if (userHome.empty()) {
char *userProfile = getenv(ENV_USER_PROFILE);
if (userProfile) {
userHome = userProfile;
} else {
TCHAR userHomeChar[MAX_PATH];
if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, userHomeChar))) {
return false;
}
userHome = userHomeChar;
userHome.erase(userHome.rfind('\\'));
}
logMsg("User home: %s", userHome.c_str());
}
userDir = userHome + (str + strlen(HOME_TOKEN));
} else if (strncmp(str, DEFAULT_USERDIR_ROOT_TOKEN, strlen(DEFAULT_USERDIR_ROOT_TOKEN)) == 0) {
std::string s = std::string("Replacing ") + DEFAULT_USERDIR_ROOT_TOKEN;
logMsg(s.c_str());
userDir = getDefaultUserDirRoot() + (str + strlen(DEFAULT_USERDIR_ROOT_TOKEN));
} else {
getDefaultUserDirRoot();
userDir = str;
}
logMsg("NbLauncher::findUserDir(%s)", str);
userDir = str;
replaceToken(userDir);
logMsg("NbLauncher::findUserDir: %s", userDir.c_str());
return true;
}

bool NbLauncher::findCacheDir(const char *str) {
logMsg("NbLauncher::findCacheDir()");
if (strncmp(str, HOME_TOKEN, strlen(HOME_TOKEN)) == 0) {
if (userHome.empty()) {
char *userProfile = getenv(ENV_USER_PROFILE);
if (userProfile) {
userHome = userProfile;
} else {
TCHAR userHomeChar[MAX_PATH];
if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, userHomeChar))) {
return false;
}
userHome = userHomeChar;
userHome.erase(userHome.rfind('\\'));
}
logMsg("User home: %s", userHome.c_str());
}
cacheDir = userHome + (str + strlen(HOME_TOKEN));
} else if (strncmp(str, DEFAULT_CACHEDIR_ROOT_TOKEN, strlen(DEFAULT_CACHEDIR_ROOT_TOKEN)) == 0) {
std::string s = std::string("Replacing ") + DEFAULT_CACHEDIR_ROOT_TOKEN;
logMsg(s.c_str());
cacheDir = getDefaultCacheDirRoot() + (str + strlen(DEFAULT_CACHEDIR_ROOT_TOKEN));
} else {
getDefaultCacheDirRoot();
cacheDir = str;
}
logMsg("NbLauncher::findCacheDir(%s)", str);
cacheDir = str;
replaceToken(cacheDir);
logMsg("NbLauncher::findCacheDir: %s", cacheDir.c_str());
return true;
}

string NbLauncher::getDefaultUserDirRoot() {
void NbLauncher::replaceToken(std::string& str) {
// Replace the allowed tokens in configuration options
replaceString(str, HOME_TOKEN, userHome);
replaceString(str, DEFAULT_CACHEDIR_ROOT_TOKEN, defCacheDirRoot);
replaceString(str, DEFAULT_USERDIR_ROOT_TOKEN, defUserDirRoot);
replaceString(str, BASEDIR_TOKEN, baseDir);
}

void NbLauncher::replaceString(std::string& str, const std::string& from, const std::string& to) {
if(from.empty()) {
return;
}
// Loop over all occurrences of the search string in the input string and
// replace them all
size_t start_pos = 0;
while((start_pos = str.find(from, start_pos)) != std::string::npos) {
str.replace(start_pos, from.length(), to);
// Skip over the replacement
start_pos += to.length();
}
}

void NbLauncher::getDefaultUserDirRoot() {
TCHAR defUserDirRootChar[MAX_PATH];
if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, defUserDirRootChar))) {
return std::string();
defUserDirRoot = std::string();
}
defUserDirRoot = constructApplicationDir((string) defUserDirRootChar, false);
defUserDirRoot.erase(defUserDirRoot.rfind('\\'));
logMsg("Default Userdir Root: %s", defUserDirRoot.c_str());
return defUserDirRoot;
}

string NbLauncher::getDefaultCacheDirRoot() {
void NbLauncher::getDefaultCacheDirRoot() {
TCHAR defCacheDirRootChar[MAX_PATH];
if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, defCacheDirRootChar))) {
return std::string();
defCacheDirRoot = std::string();
}
defCacheDirRoot = constructApplicationDir((string) defCacheDirRootChar, true);
defCacheDirRoot.erase(defCacheDirRoot.rfind('\\'));
logMsg("Default Cachedir Root: %s", defCacheDirRoot.c_str());
return defCacheDirRoot;
}

void NbLauncher::getUserHome() {
char *userProfile = getenv(ENV_USER_PROFILE);
if (userProfile) {
userHome = userProfile;
} else {
TCHAR userHomeChar[MAX_PATH];
if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, userHomeChar))) {
defCacheDirRoot = std::string();
userHome = std::string();
}
userHome = userHomeChar;
userHome.erase(userHome.rfind('\\'));
}
logMsg("User home: %s", userHome.c_str());
}

bool NbLauncher::getOption(char *&str, const char *opt) {
Expand Down Expand Up @@ -492,12 +492,15 @@ bool NbLauncher::parseConfigFile(const char* path) {
}
str[k] = '\0';
nbOptions = str;
replaceToken(nbOptions);
logMsg("After replacement: %s", nbOptions.c_str());

} else if (getOption(str, getExtraClustersOptName())) {
extraClusters = str;
} else if (getOption(str, getJdkHomeOptName())) {
jdkHome = str;
replaceToken(jdkHome);
logMsg("jdkHome: %s", jdkHome.c_str());
}
}
bool ok = ferror(file) == 0;
Expand Down
9 changes: 7 additions & 2 deletions nb/ide.launcher/windows/nblauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class NbLauncher {
static const char *REG_DEFAULT_USERDIR_ROOT;
static const char *REG_DEFAULT_CACHEDIR_ROOT;
static const char* staticOptions[];
static const char *BASEDIR_TOKEN;
static const char *USERDIR_TOKEN;

typedef int (*StartPlatform)(int argc, char *argv[]);

Expand Down Expand Up @@ -82,8 +84,11 @@ class NbLauncher {
bool getOption(char *&str, const char *opt);
void addCluster(const char *cl);
void addExtraClusters();
std::string getDefaultUserDirRoot();
std::string getDefaultCacheDirRoot();
void getDefaultUserDirRoot();
void getDefaultCacheDirRoot();
void getUserHome();
void replaceToken(std::string& str);
void replaceString(std::string& str, const std::string& from, const std::string& to);

protected:
std::string baseDir;
Expand Down
2 changes: 1 addition & 1 deletion nb/ide.launcher/windows/netbeans.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="101.2.0.0"
<assemblyIdentity version="101.3.0.0"
processorArchitecture="x86"
name="netbeans.exe"
type="win32"/>
Expand Down
2 changes: 1 addition & 1 deletion nb/ide.launcher/windows/netbeans64.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!-- Use processorArchitecture="x86", which is the value used by the 64-bit
javaw.exe on Java 10.0.2 and Java 11ea. -->
<assemblyIdentity version="101.2.0.0"
<assemblyIdentity version="101.3.0.0"
processorArchitecture="x86"
name="netbeans64.exe"
type="win32"/>
Expand Down
6 changes: 3 additions & 3 deletions nb/ide.launcher/windows/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

#define COMPANY ""
#define COMPONENT "Apache NetBeans IDE Launcher"
#define VER "101.2.0.0"
#define FVER 101,2,0,0
#define BUILD_ID "101200"
#define VER "101.3.0.0"
#define FVER 101,3,0,0
#define BUILD_ID "101300"
#define INTERNAL_NAME "netbeans"
#define COPYRIGHT "Based on Apache NetBeans from the Apache Software Foundation and is licensed under Apache License Version 2.0"
#define NAME "Apache NetBeans IDE Launcher"
Expand Down
8 changes: 4 additions & 4 deletions platform/o.n.bootstrap/launcher/windows/Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ nbexec64.res: nbexec.rc
x86_64-w64-mingw32-windres -o$(TMPFLD)nbexec64.res -Ocoff nbexec.rc

nbexec64.dll: include/jni.h include/jni_types.h jvmlauncher.cpp nbexec.cpp platformlauncher.cpp utilsfuncs.cpp nbexec64.res
x86_64-w64-mingw32-gcc -s -shared -m64 -o $(OFLD)nbexec64.dll -I include jvmlauncher.cpp nbexec.cpp platformlauncher.cpp utilsfuncs.cpp $(TMPFLD)nbexec64.res -Wl,--no-insert-timestamp -static -lstdc++ -static-libstdc++ -static-libgcc
x86_64-w64-mingw32-gcc -s -shared -m64 -o $(OFLD)nbexec64.dll -I include jvmlauncher.cpp nbexec.cpp platformlauncher.cpp utilsfuncs.cpp $(TMPFLD)nbexec64.res -Wl,--no-insert-timestamp -static -lstdc++ -lshlwapi -static-libstdc++ -static-libgcc

nbexec_exe64.res: nbexec_exe.rc nbexec.exe.manifest
x86_64-w64-mingw32-windres -o$(TMPFLD)nbexec_exe64.res -Ocoff -DMANIFEST_FILE=nbexec.exe.manifest nbexec_exe.rc

nbexec64.exe: nbexecexe.cpp utilsfuncs.cpp nbexec_exe64.res
x86_64-w64-mingw32-gcc -s -DNBEXEC_DLL='"nbexec64.dll"' -DARCHITECTURE=64 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -Wl,--no-insert-timestamp -mwindows nbexecexe.cpp utilsfuncs.cpp $(TMPFLD)nbexec_exe64.res -o$(OFLD)nbexec64.exe -static -lstdc++ -static-libstdc++ -static-libgcc
x86_64-w64-mingw32-gcc -s -DNBEXEC_DLL='"nbexec64.dll"' -DARCHITECTURE=64 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -Wl,--no-insert-timestamp -mwindows nbexecexe.cpp utilsfuncs.cpp $(TMPFLD)nbexec_exe64.res -o$(OFLD)nbexec64.exe -static -lstdc++ -lshlwapi -static-libstdc++ -static-libgcc

nbexec.res: nbexec.rc
i686-w64-mingw32-windres -o$(TMPFLD)nbexec.res -Ocoff nbexec.rc

nbexec.dll: include/jni.h include/jni_types.h jvmlauncher.cpp nbexec.cpp platformlauncher.cpp utilsfuncs.cpp nbexec.res
i686-w64-mingw32-gcc -s -shared -o $(OFLD)nbexec.dll -I include jvmlauncher.cpp nbexec.cpp platformlauncher.cpp utilsfuncs.cpp $(TMPFLD)nbexec.res -static -Wl,--no-insert-timestamp -lstdc++ -static-libstdc++ -static-libgcc
i686-w64-mingw32-gcc -s -shared -o $(OFLD)nbexec.dll -I include jvmlauncher.cpp nbexec.cpp platformlauncher.cpp utilsfuncs.cpp $(TMPFLD)nbexec.res -static -Wl,--no-insert-timestamp -lstdc++ -lshlwapi -static-libstdc++ -static-libgcc

nbexec_exe.res: nbexec_exe.rc nbexec.exe.manifest
i686-w64-mingw32-windres -o$(TMPFLD)nbexec_exe.res -Ocoff -DMANIFEST_FILE=nbexec.exe.manifest nbexec_exe.rc

nbexec.exe: nbexecexe.cpp utilsfuncs.cpp nbexec_exe.res
i686-w64-mingw32-gcc -s -DNBEXEC_DLL='"nbexec.dll"' -DARCHITECTURE=32 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -Wl,--no-insert-timestamp -mwindows nbexecexe.cpp utilsfuncs.cpp $(TMPFLD)nbexec_exe.res -o$(OFLD)nbexec.exe -static -lstdc++ -static-libstdc++ -static-libgcc
i686-w64-mingw32-gcc -s -DNBEXEC_DLL='"nbexec.dll"' -DARCHITECTURE=32 -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-seh -Wl,--no-insert-timestamp -mwindows nbexecexe.cpp utilsfuncs.cpp $(TMPFLD)nbexec_exe.res -o$(OFLD)nbexec.exe -static -lstdc++ -lshlwapi -static-libstdc++ -static-libgcc
Loading
Loading