Created
April 5, 2013 00:04
-
-
Save andyhuey/5315524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Array getProjectList() | |
{ | |
// get the project list from a file. | |
str startProjFileName; | |
TextBuffer tbProjList; | |
Array projects = new Array(Types::String); | |
int nProjects; | |
startProjFileName = this.getStartProjFileName(); | |
tbProjList = new TextBuffer(); | |
// if it doesn't exist, create an empty file & return. | |
if (!WinAPI::fileExists(startProjFileName)) | |
{ | |
WinAPI::createFile(startProjFileName); | |
return projects; | |
} | |
// should probably assert permission... | |
tbProjList.fromFile(startProjFileName); | |
nProjects = 0; | |
while (tbProjList.nextToken(true)) | |
{ | |
nProjects++; | |
projects.value(nProjects, tbProjList.token()); | |
} | |
return projects; | |
} | |
private boolean writeProjectList(Array projects) | |
{ | |
// write out a project list to file, overwriting existing list. | |
str startProjFileName; | |
TextBuffer tbProjList; | |
int i; | |
startProjFileName = this.getStartProjFileName(); | |
tbProjList = new TextBuffer(); | |
for (i=1; i <= projects.lastIndex(); i++) | |
{ | |
tbProjList.appendText(projects.value(i)); | |
tbProjList.appendText("\n"); | |
} | |
return tbProjList.toFile(startProjFileName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment