IDEMPIERE-5795: DeveloperMode context variable (#1929)
https: //idempiere.atlassian.net/browse/IDEMPIERE-5795 Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
parent
00c4fec2f4
commit
71a49baf00
|
@ -529,9 +529,8 @@ public abstract class Convert
|
|||
public static String getMigrationScriptFolder(String dbtype) {
|
||||
// migration/iD[version]/[oracle|postgresql] directory
|
||||
String version = Adempiere.MAIN_VERSION.substring(8);
|
||||
boolean isIDE = Files.isDirectory(Paths.get(Adempiere.getAdempiereHome() + File.separator + "org.adempiere.base"));
|
||||
String homeScript;
|
||||
if (isIDE)
|
||||
if (Util.isDeveloperMode())
|
||||
homeScript = Adempiere.getAdempiereHome() + File.separator;
|
||||
else
|
||||
homeScript = System.getProperty("java.io.tmpdir") + File.separator;
|
||||
|
|
|
@ -118,6 +118,7 @@ public final class Env
|
|||
public static final String HAS_ALIAS = "$HasAlias";
|
||||
public static final String IS_CAN_APPROVE_OWN_DOC = "#IsCanApproveOwnDoc";
|
||||
public static final String IS_CLIENT_ADMIN = "#IsClientAdmin";
|
||||
public static final String DEVELOPER_MODE = "#DeveloperMode";
|
||||
/** Context Language identifier */
|
||||
public static final String LANGUAGE = "#AD_Language";
|
||||
public static final String LANGUAGE_NAME = "#LanguageName";
|
||||
|
|
|
@ -874,6 +874,7 @@ public class Login
|
|||
|
||||
// Other Settings
|
||||
Env.setContext(m_ctx, "#YYYY", "Y");
|
||||
Env.setContext(m_ctx, Env.DEVELOPER_MODE, Util.isDeveloperMode() ? "Y" : "N");
|
||||
Env.setContext(m_ctx, Env.STANDARD_PRECISION, 2);
|
||||
|
||||
// AccountSchema Info (first)
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
|
@ -42,6 +44,8 @@ import javax.swing.InputMap;
|
|||
import javax.swing.JComponent;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.DocumentException;
|
||||
import com.lowagie.text.pdf.PdfContentByte;
|
||||
|
@ -777,4 +781,11 @@ public class Util
|
|||
return value == null ? false : value.matches(UUID_REGEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if there is a directory org.adempiere.base within AdempiereHome (is the case when executed from Eclipse)
|
||||
*/
|
||||
public static boolean isDeveloperMode() {
|
||||
return Files.isDirectory(Paths.get(Adempiere.getAdempiereHome() + File.separator + "org.adempiere.base"));
|
||||
}
|
||||
|
||||
} // Util
|
||||
|
|
Loading…
Reference in New Issue