📄 propertiespathname.java
字号:
/*====================================================================*\PropertiesPathname.javaProperties pathname class.------------------------------------------------------------------------This file is part of FuncPlotter, a combined Java application and appletfor plotting explicit functions in one variable.Copyright 2005-2007 Andy Morgan-Richards.FuncPlotter is free software: you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation, either version 3 of the License, or (at youroption) any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith this program. If not, see <http://www.gnu.org/licenses/>.\*====================================================================*/// PACKAGEpackage util;//----------------------------------------------------------------------// IMPORTSimport java.io.File;import javax.swing.JApplet;//----------------------------------------------------------------------// PROPERTIES PATHNAME CLASSpublic class PropertiesPathname{////////////////////////////////////////////////////////////////////////// Constants//////////////////////////////////////////////////////////////////////// private static final String APP_PREFIX = "app."; private static final String PROPERTIES_PATH_PROPERTY_KEY = "propertiesPath"; private static final String DEFAULT_PROPERTIES_PATH = ".puckfist";////////////////////////////////////////////////////////////////////////// Constructors//////////////////////////////////////////////////////////////////////// private PropertiesPathname( ) { } //------------------------------------------------------------------////////////////////////////////////////////////////////////////////////// Class methods//////////////////////////////////////////////////////////////////////// public static String getPathname( ) { return getPathname( null ); } //------------------------------------------------------------------ public static String getPathname( JApplet applet ) { String pathname = null; try { pathname = (applet == null) ? System.getProperty( APP_PREFIX + PROPERTIES_PATH_PROPERTY_KEY ) : applet.getParameter( APP_PREFIX + PROPERTIES_PATH_PROPERTY_KEY ); if ( pathname == null ) { pathname = System.getProperty( "user.home" ); if ( pathname != null ) pathname += File.separator + DEFAULT_PROPERTIES_PATH; } else pathname = PropertyString.parsePathname( pathname ); if ( (pathname != null) && !pathname.endsWith( File.separator ) && !pathname.endsWith( "/" ) ) pathname += File.separator; } catch ( SecurityException e ) { // ignore } return pathname; } //------------------------------------------------------------------}//----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -