java.lang.Objectcom.install4j.api.windows.WinFileSystem
public class WinFileSystem
Collection of static methods to access Microsoft Windows-specific folder locations and to execute native file system operations.
| Field Summary | |
|---|---|
static int |
FOLDER_APPDATA
Identifies the file system directory that serves as a common repository for application-specific data. |
static int |
FOLDER_DESKTOP
Identifies the file system directory used to physically store file objects on the desktop. |
static int |
FOLDER_DOCS
Identifies the file system directory used to physically store a user's common repository of documents. |
static int |
FOLDER_FAVORITES
Identifies the file system directory that serves as a common repository for the user's favorite items. |
static int |
FOLDER_FONTS
Identifies a virtual folder containing fonts. |
static int |
FOLDER_LOCAL_APPDATA
Identifies the file system directory that serves as a data repository for local applications. |
static int |
FOLDER_PROGRAMS
Identifies the file system directory that contains the user's program groups. |
static int |
FOLDER_SENDTO
Identifies the file system directory that contains Send To menu items. |
static int |
FOLDER_STARTMENU
Identifies the file system directory containing Start menu items. |
static int |
FOLDER_STARTUP
Identifies the file system directory that corresponds to the user's Startup program group. |
static int |
FOLDER_TEMPLATES
Identifies the file system directory that serves as a common repository for document templates. |
| Method Summary | |
|---|---|
static boolean |
createShellLink(java.io.File file,
java.io.File shortcutTo,
java.io.File iconFile)
Creates a shell link. |
static boolean |
createShellLink(java.io.File file,
java.io.File shortcutTo,
java.io.File iconFile,
java.lang.String arguments)
Creates a shell link. |
static void |
createStartMenuEntry(InstallerContext context,
java.lang.String name,
java.io.File destination,
java.io.File icon)
Creates an additional start menu entry if start menu creation is enabled by the installer context. |
static java.io.File |
getCommonFilesDirectory()
Returns a folder for components that are shared across applications. |
static java.io.File |
getProgramFilesDirectory()
Returns the program files directory of the current Windows installation. |
static java.io.File |
getSpecialFolder(int folderType,
boolean allUsers)
Returns Windows-specific directories like the start menu or the desktop. |
static java.io.File |
getSystemDirectory()
Returns the system directory. |
static java.io.File |
getWindowsDirectory()
Returns the "indows directory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FOLDER_DESKTOP
public static final int FOLDER_STARTMENU
public static final int FOLDER_PROGRAMS
public static final int FOLDER_STARTUP
public static final int FOLDER_SENDTO
public static final int FOLDER_FONTS
public static final int FOLDER_APPDATA
public static final int FOLDER_DOCS
public static final int FOLDER_TEMPLATES
public static final int FOLDER_FAVORITES
public static final int FOLDER_LOCAL_APPDATA
| Method Detail |
|---|
public static java.io.File getSpecialFolder(int folderType,
boolean allUsers)
folderType - specifies the requested folder type. Supply one of the FOLDER_
constants.allUsers - if this parameter is true and if the current user is in the
Administrators group, the method returns the requested folder for all users.
Otherwise it returns the folder for the current user.
public static java.io.File getProgramFilesDirectory()
public static java.io.File getCommonFilesDirectory()
public static java.io.File getWindowsDirectory()
public static java.io.File getSystemDirectory()
public static boolean createShellLink(java.io.File file,
java.io.File shortcutTo,
java.io.File iconFile)
file - the shell link that should be created inluding the lnk suffix.shortcutTo - the file it should link to.iconFile - an optional icon file. If null is given, the icon of the
shortcutTo target will be used.
public static boolean createShellLink(java.io.File file,
java.io.File shortcutTo,
java.io.File iconFile,
java.lang.String arguments)
file - the shell link that should be created inluding the lnk suffix.shortcutTo - the file it should link to.iconFile - an optional icon file. If null is given, the icon of the
shortcutTo target will be used.arguments - the arguments passed to the target.
public static void createStartMenuEntry(InstallerContext context,
java.lang.String name,
java.io.File destination,
java.io.File icon)
throws java.io.IOException
context - the InstallerContext you receive in Actions and Screensname - the name of the menu entry. You can create subfolders with a backslashdestination - the file you want to link toicon - an optional icon file. If null is given, the icon of the
destination will be used.
java.io.IOException - if it cannot create the folder for the menu entry