FilesIO Module
Types
Functions and values
| Function or value | Description |
Full Usage:
admitProjectFolder path
Parameters:
string
Returns: bool
|
Ask for a folder chosen in the project browser to be made readable, and say whether it was. Every other read here goes through a channel confined to directories Issie already has a reason to trust, and a folder just picked out of the browser is not yet one of them. Main decides, by looking at the folder itself rather than taking the renderer's word: it admits one that holds sheets or a project marker. False therefore means "no project there", not "refused".
|
Full Usage:
askForExistingProjectPath defaultPath
Parameters:
string option
Returns: string option
|
Ask the user to choose a project, with a dialog window. Return the chosen folder, or None if the user exits without choosing one. A project IS a directory, so that is what the dialog asks for. It used to ask for the .dprj inside one, which meant navigating into the project, past its sheets greyed out by the filter, to select a file that is empty, says nothing, and is named after the folder the user was already standing in - and whose directory was then all that was kept. Asking for the folder also lets a project whose marker was lost or renamed be opened, which the filter made impossible even though loading a project never reads it.
|
Full Usage:
askForExistingSheetPaths defaultPath
Parameters:
string option
Returns: string list option
|
|
Full Usage:
askForFolder title buttonLabel defaultPath
Parameters:
string
buttonLabel : string
defaultPath : string option
Returns: string option
|
|
Full Usage:
askForNewFile projectPath
Parameters:
string
Returns: string option
|
|
Full Usage:
backupFileData path baseName
Parameters:
string
baseName : string
Returns: (int option * string) list
|
|
Full Usage:
baseName filePath
Parameters:
string
Returns: string
|
|
Full Usage:
baseNameWithoutExtension
Returns: string -> string
|
|
Full Usage:
browseFolderForOpening path
Parameters:
string
Returns: Result<FolderEntry list, string>
|
Every immediate subdirectory of `path`, classified, for the browser to draw - or why the folder could not be listed. One level only: this lists a folder, it does not search a disk. A native folder picker draws every folder alike, so it cannot show which of them hold projects - which is the whole reason Issie draws this list itself. Deliberately NOT readSubdirectories and inspectFolder, which reach the operating system through the confined filesystem channel. The folder being browsed is by definition one the user has not opened yet, so every folder worth showing was refused: the dialog opened on the folder holding the last project and reported that the user's Documents did not exist. The browse channel in src/Main/Bridge.fs answers this one question without that confinement, and carries names and counts rather than the contents of anything.
|
|
|
Full Usage:
classifyFolder hasMarker sheetCount
Parameters:
bool
sheetCount : int
Returns: ProjectDirectory
|
|
Full Usage:
copyFile sourcePath newPath
Parameters:
string
newPath : string
|
|
Full Usage:
copySheetWithNewIds sourcePath newPath
Parameters:
string
newPath : string
|
|
Full Usage:
createEmptyDgmFile folderPath baseName
Parameters:
string
baseName : string
Returns: Result<unit, string>
|
|
Full Usage:
dirName filePath
Parameters:
string
Returns: string
|
|
Full Usage:
ensureDirectory dPath
Parameters:
string
|
|
Full Usage:
exists filePath
Parameters:
string
Returns: bool
|
|
Full Usage:
extName filePath
Parameters:
string
Returns: string
|
|
Full Usage:
fileExistsWithExtn extn folderPath baseName
Parameters:
string
folderPath : string
baseName : string
Returns: bool
|
|
Full Usage:
fileNameIsBad name
Parameters:
char seq
Returns: bool
|
|
Full Usage:
filePathIsBad
Returns: string -> bool
|
|
Full Usage:
getBaseNameNoExtension filePath
Parameters:
string
Returns: string
|
|
Full Usage:
getCWD u
Parameters:
unit
Returns: string
|
|
Full Usage:
getLatestCanvas state
Parameters:
SavedInfo
Returns: Component list * Connection list
|
|
|
Update from old component types to new In addition do some sanity checks The standard way to add functionality to an existing component is to create a new component type, keeping the old type. Then on reading sheets from disk both new and old will be correctly read. This function will be called on load and will convert from the old type to the new one so that the rest of issie need only process new types, but compatibility with saved old types remains.
|
Full Usage:
hasExtn extn fName
Parameters:
string
fName : string
Returns: bool
|
|
|
|
|
|
|
|
Full Usage:
isDirectory filePath
Parameters:
string
Returns: bool
|
|
Full Usage:
isFilesystemRoot path
Parameters:
string
Returns: bool
|
|
|
|
Full Usage:
latestBackupFileData path baseName
Parameters:
string
baseName : string
Returns: (int * string) option
|
|
Full Usage:
loadAllComponentFiles folderPath
Parameters:
string
Returns: Result<LoadStatus list, string>
|
|
Full Usage:
magnifySheet magnification comp
Parameters:
float
comp : LegacyComponent
Returns: LegacyComponent
|
|
Full Usage:
makeData aWidth dWidth makeFun
Parameters:
int
dWidth : int
makeFun : int -> int -> bigint
Returns: Map<bigint, bigint>
|
|
|
|
Full Usage:
makeLoadedComponentFromCanvasData (arg1, arg2) filePath timeStamp waveInfo sheetInfo
Parameters:
Component list
arg1 : Connection list
filePath : string
timeStamp : DateTime
waveInfo : SavedWaveInfo option
sheetInfo : SheetInfo option
Returns: LoadedComponent * Component list
|
|
Full Usage:
mkdir folderPath
Parameters:
string
|
|
Full Usage:
modifiedTimeMs filePath
Parameters:
string
Returns: float option
|
|
Full Usage:
openFolderInFileManager path onError
Parameters:
string
onError : string -> unit
|
Show a directory in the platform's file manager. On Windows this launches explorer.exe rather than calling shell.openPath, because the folder window is created by the already-running explorer.exe, which has no right to take the foreground away from Issie - so shell.openPath opens it *behind* the app. A process launched by the foreground process does have that right and passes it on. Measured on Windows 11: through shell.openPath the window lands immediately below Issie and Issie keeps focus, through the spawn immediately above it and focused. Every other platform raises it already, and shell.openPath is the portable route there. onError is given a readable reason when the directory cannot be shown. On platforms other than Windows it is called asynchronously, since shell.openPath reports failure by resolving with a non-empty message rather than by rejecting - so saying nothing would make a failure look like success.
|
Full Usage:
openWriteDialogAndWriteMemory mem path
Parameters:
Memory1
path : string
Returns: string option
|
|
Full Usage:
pathJoin args
Parameters:
string array
Returns: string
|
|
Full Usage:
pathWithoutExtension filePath
Parameters:
string
Returns: string
|
|
Full Usage:
projectMarkerPath projectPath
Parameters:
string
Returns: string
|
|
Full Usage:
projectNameError name
Parameters:
string
Returns: string option
|
Why a project may not be called this, if it may not. One rule, in one place: the creation form asks it of every keystroke so that the user sees the objection while they can still act on it, and tryCreateFolder asks it as the last word. It used to be reachable only by breaking it, after the native dialog had been dismissed, in an error box that took the typing with it.
|
Full Usage:
readFile filePath
Parameters:
string
Returns: string
|
|
Full Usage:
readFilesFromDirectory path
Parameters:
string
Returns: string list
|
|
Full Usage:
readFilesFromDirectoryWithExtn path extn
Parameters:
string
extn : string
Returns: string list
|
|
Full Usage:
readMemDefnLine addressWidth wordWidth lineNo s
Parameters:
int
wordWidth : int
lineNo : int
s : string
Returns: Result<(bigint * bigint * string option), string>
|
|
|
|
Full Usage:
readMemLines addressWidth wordWidth lines
Parameters:
int
wordWidth : int
lines : string array
Returns: Result<(bigint * bigint * string option) array, string>
|
|
Full Usage:
readSubdirectories folderPath
Parameters:
string
Returns: string list
|
The immediate subdirectories of a folder, as full paths. [] if it cannot be read. Deliberately not readdir: under .NET that is Directory.GetFiles, which lists files only, while node's readdirSync lists directories too. Anything looking for subfolders through readdir therefore works in the app and finds nothing under test - which is how this function came to exist. The directories come from the one readdir rather than from a stat of each entry, which is what this used to do: existsSync and lstatSync per name, paid on every FILE in the folder before discarding it. Listing C:\Windows\System32 took 244ms that way and takes 3ms this way - 4,885 entries, of which 4,687 were files answering a question nobody asked. Directory.GetDirectories never had the problem, so only the node side changes.
|
Full Usage:
readdir folderPath
Parameters:
string
Returns: string array
|
|
Full Usage:
removeAutoFile folderPath baseName
Parameters:
string
baseName : string
|
|
Full Usage:
removeExtn extn fName
Parameters:
string
fName : string
Returns: string option
|
|
Full Usage:
removeFile folderPath baseName
Parameters:
string
baseName : string
|
|
Full Usage:
removeFileWithExtn extn folderPath baseName
Parameters:
string
folderPath : string
baseName : string
|
|
Full Usage:
rename oldPath newPath
Parameters:
string
newPath : string
|
|
Full Usage:
renameFile extn folderPath baseName newBaseName
Parameters:
string
folderPath : string
baseName : string
newBaseName : string
Returns: Result<unit, string>
|
|
|
|
Full Usage:
saveStateToFile folderPath baseName (arg3, arg4, arg5)
Parameters:
string
baseName : string
arg2 : CanvasState
arg3 : SavedWaveInfo option
arg4 : SheetInfo option
Returns: Result<unit, string>
|
|
Full Usage:
saveStateToFileExperimental folderPath baseName (arg3, arg4, arg5)
Parameters:
string
baseName : string
arg2 : CanvasState
arg3 : SavedWaveInfo option
arg4 : SheetInfo option
Returns: Result<unit, string>
|
|
Full Usage:
splitMemDefnComment s
Parameters:
string
Returns: string * string option
|
|
Full Usage:
staticDir ()
Parameters:
unit
Returns: string
|
Absolute path to the static asset directory. This used to be worked out here, three ways: __static in development, a bare "./resources/static" relative to the working directory for production on Windows and Linux, and __dirname/../../static for production on macOS. All three land on the same place as the main process's process.resourcesPath, and __static in particular is a webpack substitution that expands to an expression over `path` and `process` - so it could not survive contextIsolation even in principle. Main resolves it once now and sends the answer; see Bridge.staticDirectory.
|
Full Usage:
staticFileDirectory
Returns: string
|
|
|
|
|
|
|
|
Full Usage:
tryLoadComponentFromPath filePath
Parameters:
string
Returns: Result<LoadedComponent, string>
|
|
|
|
|
The per-user, writable Issie directory. Anything Issie writes for the user - demo working copies, component libraries the user makes or imports - belongs here and NOT beside the installation. On macOS the app bundle is signed and notarised, so writing inside it invalidates the signature and Gatekeeper can then refuse to launch it. On Windows the installation is usually under Program Files, which needs administrator rights to write. Both fail only for installed users, never in a development build, which is exactly the kind of bug that ships.
|
|
|
|
|
Full Usage:
unlink folderPath
Parameters:
string
|
|
Full Usage:
writeFile path data
Parameters:
string
data : string
Returns: Result<unit, string>
|
|
|
|