-
Notifications
You must be signed in to change notification settings - Fork 66
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
[WIP] Voxelshop creates .profile
*directory* which breaks rustup
.
#305
Comments
Turns out I couldn't resist the temptation to decompile the non-open source code and track down the issue for sure... :D So, the issue is occurring due to the // From: `com.jidesoft.swing.AbstractLayoutPersistence` in `jide-common-3.4.8.jar`
//
// (via jadx-gui 0.9.0)
public abstract class AbstractLayoutPersistence implements LayoutPersistence {
protected static final String DEFAULT_PROFILE_NAME = "default";
// [...]
public static final String PROPERTY_PROFILE_KEY = "profileKey";
public static final String PROPERTY_USE_PREF = "usePref";
public static final String PROPERTY_VERSION = "version";
// [...]
protected final String LAYOUT_POSTFIX = ".layout";
protected String _layoutDirectory = null;
protected boolean _loadingLayoutData = false;
protected String _profileKey = "profile"; // <---------------- [HERE!]
// [...]
protected boolean _usePref = true;
// [...]
public String getLayoutDirectory() {
boolean z = f28i;
String str = this._layoutDirectory;
if (z) {
return str;
}
if (str != null) {
return this._layoutDirectory;
}
str = SecurityUtils.getProperty("user.home", "") + File.separator + "." + this._profileKey;
File file = new File(str);
boolean isDirectory = file.isDirectory();
if (!z) {
if (isDirectory) {
return str;
}
isDirectory = file.mkdirs(); // <---------------- [And HERE!]
}
if (isDirectory) {
return str;
}
System.err.println("Failed to create directory: " + str);
return str;
} Other occurrences of this patternA quick code search for It also occurs in |
[WIP report, hope to add some more details but this is better than nothing. :) ]
Problem
When Voxelshop first runs (and before
.voxelshop
is created AFAICT), it creates a directory named.profile
.On a Mac this is located at:
~/.profile/default.layout
a.k.a$HOME/.profile/default.layout
a.k.a./Users/<username>/.profile/default.layout
This issue was also mentioned in passing in #295 (comment).
(I encountered this issue nearly a year after I first tried out Voxelshop and was only able to match the creation of the
~/.profile
directory to Voxelshop because I noticed that the creation time was around the same time as~/.voxelshop
.)Apparent cause
After a lot of searching, I think I've identified why this is happening.
AFAICT the code that is creating the directory is in the (closed) portions of the
com.jidesoft
application framework--specifically the code related to layout persistence (primarily docking related?).In
JIDE_Docking_Framework_Developer_Guide.pdf
there is a section that talks about layout persisting which mentions:And later on:
Note: My supposition is that the documentation is incorrect when it says the default
profileName
value is"default"
; or, when the order of calls is incorrect theprofileName
is different (e.g."profile"
leading to.profile
as the filename).It's not entirely clear to me if the correct order is used in the relevant code:
voxelshop/src/main/java/com/vitco/app/layout/WindowManager.java
Lines 533 to 541 in 4094dd1
Update: See comment below for a de-compilation of the relevant code, that explains what is happening behind the scenes.
Potential fix
It seems that a call to
setProfileKey()
(on the manager, or all classes that use layout persistence) needs to occur before any call to a method that directly or indirectly callsgetLayoutDirectory()
.Example
setProfileKey()
use:jide/demo/SimplestActionFrameworkDemo.java
Additional details
If
~/.profile
exists as a file an error appears in the console:Related links
AbstractLayoutPersistence
:getLayoutDirectory()
&setProfileKey()
LayoutPersistence
:getLayoutDirectory()
&setProfileKey()
LayoutPersistenceManager
:setProfileKey()
http://www.jidesoft.com/javadoc/com/jidesoft/action/DockableBarManager.html#methods_inherited_from_class_com.jidesoft.swing.LayoutPersistence
App loader:
com/vitco/app/glue/config.xml
https://github.com/simlu/voxelshop/blob/master/src/main/java/com/vitco/app/layout/LayoutLoader.java
https://www.jidesoft.com/jdaf/JIDE_Desktop_Application_Framework_Developer_Guide.pdf
http://www.jidesoft.com/jdaf/
http://www.jidesoft.com/products/oss.htm
http://www.jidesoft.com/products/dock.htm
The text was updated successfully, but these errors were encountered: