mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Change path_projectinfo to NSString.
This commit is contained in:
parent
00d33ccbf4
commit
7ec21cbb39
3 changed files with 20 additions and 23 deletions
|
@ -124,9 +124,7 @@ _atof (const char *c)
|
|||
|
||||
- (id) setCurrentProject: sender
|
||||
{
|
||||
[startproject_i setStringValue: [NSString stringWithCString: [project_i
|
||||
currentProjectFile
|
||||
]]];
|
||||
[startproject_i setStringValue: [project_i currentProjectFile]];
|
||||
[self UIChanged: self];
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ extern id project_i;
|
|||
|
||||
id BSPoutput_i; // outlet to Text
|
||||
|
||||
char path_projectinfo[128]; // path of QE_Project file
|
||||
NSString *path_projectinfo; // path of QE_Project file
|
||||
|
||||
char path_basepath[128]; // base path of heirarchy
|
||||
|
||||
|
@ -72,7 +72,7 @@ extern id project_i;
|
|||
- (id) initProject;
|
||||
- (id) initVars;
|
||||
|
||||
- (const char *) currentProjectFile;
|
||||
- (NSString *) currentProjectFile;
|
||||
|
||||
- (id) setTextureWad: (const char *)wf;
|
||||
|
||||
|
@ -81,7 +81,7 @@ extern id project_i;
|
|||
- (id) initProjSettings;
|
||||
|
||||
- (id) parseProjectFile; // read defaultsdatabase for project path
|
||||
- (id) openProjectFile: (const char *)path; // called by openProject, newProject
|
||||
- (id) openProjectFile: (NSString *)path; // called by openProject, newProject
|
||||
- (id) openProject;
|
||||
- (id) clickedOnMap: sender; // called if clicked on map in browser
|
||||
- (id) clickedOnWad: sender; // called if clicked on wad in browser
|
||||
|
|
|
@ -285,27 +285,29 @@ id project_i;
|
|||
return self;
|
||||
}
|
||||
|
||||
[self openProjectFile: path];
|
||||
[self openProjectFile: [NSString stringWithCString: path]];
|
||||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// Loads and parses a project file
|
||||
//
|
||||
- (id) openProjectFile: (const char *)path
|
||||
- (id) openProjectFile: (NSString *)path
|
||||
{
|
||||
FILE *fp;
|
||||
struct stat s;
|
||||
|
||||
Sys_Printf ("openProjectFile: %s\n", path);
|
||||
strcpy (path_projectinfo, path);
|
||||
Sys_Printf ("openProjectFile: %s\n", [path cString]);
|
||||
[path retain];
|
||||
[path_projectinfo release];
|
||||
path_projectinfo = path;
|
||||
|
||||
projectInfo = NULL;
|
||||
fp = fopen (path, "r+t");
|
||||
fp = fopen ([path cString], "r+t");
|
||||
if (fp == NULL)
|
||||
return self;
|
||||
|
||||
stat (path, &s);
|
||||
stat ([path cString], &s);
|
||||
lastModified = s.st_mtime;
|
||||
|
||||
projectInfo = [(Dict *)[Dict alloc] initFromFile: fp];
|
||||
|
@ -314,7 +316,7 @@ id project_i;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (const char *) currentProjectFile
|
||||
- (NSString *) currentProjectFile
|
||||
{
|
||||
return path_projectinfo;
|
||||
}
|
||||
|
@ -324,24 +326,21 @@ id project_i;
|
|||
//
|
||||
- (id) openProject
|
||||
{
|
||||
const char *path;
|
||||
id openpanel;
|
||||
int rtn;
|
||||
NSString *projtypes[] = {@"qpr"};
|
||||
NSArray *projtypes_array;
|
||||
NSArray *filenames;
|
||||
const char *dir;
|
||||
NSString *path;
|
||||
|
||||
openpanel = [NSOpenPanel new];
|
||||
// [openpanel allowMultipleFiles:NO];
|
||||
// [openpanel chooseDirectories:NO];
|
||||
rtn = [openpanel runModalForTypes: [NSArray arrayWithObjects: projtypes
|
||||
count: 1]];
|
||||
[openpanel setAllowsMultipleSelection:NO];
|
||||
[openpanel setCanChooseDirectories:NO];
|
||||
projtypes_array = [NSArray arrayWithObjects: projtypes count: 1];
|
||||
rtn = [openpanel runModalForTypes: projtypes_array];
|
||||
if (rtn == NSOKButton) {
|
||||
filenames = [openpanel filenames];
|
||||
dir = [[openpanel directory] cString];
|
||||
dir = "";
|
||||
path = va ("%s/%s", dir, [[filenames objectAtIndex: 0] cString]);
|
||||
strcpy (path_projectinfo, path);
|
||||
path = [filenames objectAtIndex: 0];
|
||||
[self openProjectFile: path];
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue