Namespace kh.file
Defined in: kh-file.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
kh.file.ios
|
Method Attributes | Method Name and Description |
---|---|
<static> |
kh.file.comparePaletteName(aPal, bPal)
Used to sort an array of palette by their names
|
<static> |
kh.file.createEmptyPalette()
|
<static> |
kh.file.ensureFileName(aName, aDir, aExt)
Return a filename not used in a directory.
|
<static> |
kh.file.escapeFileName(aStr, aDefault)
remove illegal characters in a filename on various plateform.
|
<static> |
kh.file.getAsyncRemoteDoc(aSpec)
Get asynchronously a remote XMLDocument.
|
<static> |
kh.file.getFile(aSpec)
|
<static> |
kh.file.getKHDir()
|
<static> |
kh.file.getPersonalPalettesDir()
|
<static> |
kh.file.getProfileDir()
|
<static> |
kh.file.getSpecialFile(aName)
Return a special file determined by a name.
|
<static> |
kh.file.getSpecOfFile(aFile)
|
<static> |
kh.file.getSyncRemoteDoc(aSpec)
this is synchronous, it will block the main UI.
|
<static> |
kh.file.listPaletteFiles(aDir)
|
<static> |
kh.file.openPaletteBySpec(aSpec, aInfoObj)
|
<static> |
kh.file.openPaletteFile(aFile)
|
<static> |
kh.file.sniffGplPalette(aFile)
|
<static> |
kh.file.writeFile(aFile, aStr, aFlags, aPerm)
write to a nsIFile.
|
<static> |
kh.file.xmlPaletteToGimp(aDoc, aName, aColumns, aComments)
Convert a XML palette to a Gimp Palette format
|
Field Detail
<static>
{nsIIOService}
kh.file.ios
Method Detail
<static>
{Int}
kh.file.comparePaletteName(aPal, bPal)
Used to sort an array of palette by their names
- Parameters:
- {PaletteInfo} aPal
- ( PaletteInfo = {name, spec} )
- {PaletteInfo} bPal
- Returns:
- {Int}
<static>
{XMLDocument}
kh.file.createEmptyPalette()
- Returns:
- {XMLDocument}
<static>
{String}
kh.file.ensureFileName(aName, aDir, aExt)
Return a filename not used in a directory.
- Parameters:
- {String} aName
- {nsiFile} aDir
- {String} aExt
- Returns:
- {String} the same filename if doesn't exist, otherwise append a integer
<static>
{String}
kh.file.escapeFileName(aStr, aDefault)
remove illegal characters in a filename on various plateform.
If the result is empty, aDefault is returned.
white characters at beginning and end are removed \ / | " * : ? < > ~ \n \r are replaced by _ \0 \b \t \v \f \r \n are removed If the filename begins by ., it's remove too (hidden files on nix)see function validateFileName(aFileName) in toolkit/content/contentAreaUtils.js
- Parameters:
- {String} aStr
- {String} aDefault
- Returns:
- {String}
<static>
{void}
kh.file.getAsyncRemoteDoc(aSpec)
Get asynchronously a remote XMLDocument.
- Parameters:
- {String} aSpec
- {Object} aObj.
- An obj = {} should be passed by reference, aObj.value will contain the xml document of the request file.
- {Function} aCallbackFn.
- A function to execute after that the document has been received.
- Returns:
- {void}
<static>
{nsIFile}
kh.file.getFile(aSpec)
- Parameters:
- {String} aSpec
- Returns:
- {nsIFile}
<static>
{nsIFile}
kh.file.getKHDir()
- Returns:
- {nsIFile} the khromaxul directory in the current profile
<static>
{nsIFile}
kh.file.getPersonalPalettesDir()
- Returns:
- {nsIFile} the directory of the personal palettes.
<static>
{nsIFile}
kh.file.getProfileDir()
- Returns:
- {nsIFile} the current profile directory
<static>
{nsIFile}
kh.file.getSpecialFile(aName)
Return a special file determined by a name.
for a list of available name, see http://mxr.mozilla.org/seamonkey/source/xpcom/io/nsDirectoryServiceDefs.h
for a list of available name, see http://mxr.mozilla.org/seamonkey/source/xpcom/io/nsDirectoryServiceDefs.h
- Parameters:
- {String} aName
- Returns:
- {nsIFile}
<static>
{String}
kh.file.getSpecOfFile(aFile)
- Parameters:
- {nsiFile} aFile
- Returns:
- {String} spec of the file
<static>
{Boolean}
kh.file.getSyncRemoteDoc(aSpec)
this is synchronous, it will block the main UI.
But we use it to get chrome files and local xml files
- Parameters:
- {String} aSpec
- {Object} aObj.
- An obj = {} should be passed by reference, aObj.value will contain the xml document of the request file.
- Returns:
- {Boolean} inform that the request is done.
<static>
{PaletteInfo[]}
kh.file.listPaletteFiles(aDir)
- Parameters:
- {nsIFile} aDir
- Returns:
- {PaletteInfo[]} ({name, spec}), containing all the palette files contained in aDir. name refer to the name of the palette (not the filename), and spec the spec of the file.
<static>
{XMLDocument}
kh.file.openPaletteBySpec(aSpec, aInfoObj)
- Parameters:
- {String} aSpec
- {Object} aInfoObj
- optiona, if passed by reference, aInfoObj will contains a boolean that indicate if the targetted file is writable.
- Returns:
- {XMLDocument}
<static>
{XMLDocument}
kh.file.openPaletteFile(aFile)
- Parameters:
- {nsIFile} aFile
- Returns:
- {XMLDocument}
<static>
{Boolean}
kh.file.sniffGplPalette(aFile)
- Parameters:
- {nsIFile} aFile
- {Object} aNameOb.
- Optional, if passed by reference, aNameObj.value will contains the internal palette name.
- Returns:
- {Boolean} True if the file is a Gimp Palette.
<static>
{Boolean}
kh.file.writeFile(aFile, aStr, aFlags, aPerm)
write to a nsIFile. The file must exists and be writable, otherwise it
will not be created, and the method will just returns false.
- Parameters:
- {nsIFile} aFile
- {String} aStr
- {Int} aFlags
- default: 0x02 | 0x08 | 0x20
- {Int} aPerm
- default: 0644
- Returns:
- {Boolean} true if success
<static>
{String}
kh.file.xmlPaletteToGimp(aDoc, aName, aColumns, aComments)
Convert a XML palette to a Gimp Palette format
- Parameters:
- {XMLDocument} aDoc
- {String} aName
- optional
- {Int} aColumns
- optional
- {String[]} aComments
- optional
- Returns:
- {String}