mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-22 19:51:54 +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
|
- (id) setCurrentProject: sender
|
||||||
{
|
{
|
||||||
[startproject_i setStringValue: [NSString stringWithCString: [project_i
|
[startproject_i setStringValue: [project_i currentProjectFile]];
|
||||||
currentProjectFile
|
|
||||||
]]];
|
|
||||||
[self UIChanged: self];
|
[self UIChanged: self];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ extern id project_i;
|
||||||
|
|
||||||
id BSPoutput_i; // outlet to Text
|
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
|
char path_basepath[128]; // base path of heirarchy
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ extern id project_i;
|
||||||
- (id) initProject;
|
- (id) initProject;
|
||||||
- (id) initVars;
|
- (id) initVars;
|
||||||
|
|
||||||
- (const char *) currentProjectFile;
|
- (NSString *) currentProjectFile;
|
||||||
|
|
||||||
- (id) setTextureWad: (const char *)wf;
|
- (id) setTextureWad: (const char *)wf;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ extern id project_i;
|
||||||
- (id) initProjSettings;
|
- (id) initProjSettings;
|
||||||
|
|
||||||
- (id) parseProjectFile; // read defaultsdatabase for project path
|
- (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) openProject;
|
||||||
- (id) clickedOnMap: sender; // called if clicked on map in browser
|
- (id) clickedOnMap: sender; // called if clicked on map in browser
|
||||||
- (id) clickedOnWad: sender; // called if clicked on wad in browser
|
- (id) clickedOnWad: sender; // called if clicked on wad in browser
|
||||||
|
|
|
@ -285,27 +285,29 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self openProjectFile: path];
|
[self openProjectFile: [NSString stringWithCString: path]];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loads and parses a project file
|
// Loads and parses a project file
|
||||||
//
|
//
|
||||||
- (id) openProjectFile: (const char *)path
|
- (id) openProjectFile: (NSString *)path
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
Sys_Printf ("openProjectFile: %s\n", path);
|
Sys_Printf ("openProjectFile: %s\n", [path cString]);
|
||||||
strcpy (path_projectinfo, path);
|
[path retain];
|
||||||
|
[path_projectinfo release];
|
||||||
|
path_projectinfo = path;
|
||||||
|
|
||||||
projectInfo = NULL;
|
projectInfo = NULL;
|
||||||
fp = fopen (path, "r+t");
|
fp = fopen ([path cString], "r+t");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
stat (path, &s);
|
stat ([path cString], &s);
|
||||||
lastModified = s.st_mtime;
|
lastModified = s.st_mtime;
|
||||||
|
|
||||||
projectInfo = [(Dict *)[Dict alloc] initFromFile: fp];
|
projectInfo = [(Dict *)[Dict alloc] initFromFile: fp];
|
||||||
|
@ -314,7 +316,7 @@ id project_i;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (const char *) currentProjectFile
|
- (NSString *) currentProjectFile
|
||||||
{
|
{
|
||||||
return path_projectinfo;
|
return path_projectinfo;
|
||||||
}
|
}
|
||||||
|
@ -324,24 +326,21 @@ id project_i;
|
||||||
//
|
//
|
||||||
- (id) openProject
|
- (id) openProject
|
||||||
{
|
{
|
||||||
const char *path;
|
|
||||||
id openpanel;
|
id openpanel;
|
||||||
int rtn;
|
int rtn;
|
||||||
NSString *projtypes[] = {@"qpr"};
|
NSString *projtypes[] = {@"qpr"};
|
||||||
|
NSArray *projtypes_array;
|
||||||
NSArray *filenames;
|
NSArray *filenames;
|
||||||
const char *dir;
|
NSString *path;
|
||||||
|
|
||||||
openpanel = [NSOpenPanel new];
|
openpanel = [NSOpenPanel new];
|
||||||
// [openpanel allowMultipleFiles:NO];
|
[openpanel setAllowsMultipleSelection:NO];
|
||||||
// [openpanel chooseDirectories:NO];
|
[openpanel setCanChooseDirectories:NO];
|
||||||
rtn = [openpanel runModalForTypes: [NSArray arrayWithObjects: projtypes
|
projtypes_array = [NSArray arrayWithObjects: projtypes count: 1];
|
||||||
count: 1]];
|
rtn = [openpanel runModalForTypes: projtypes_array];
|
||||||
if (rtn == NSOKButton) {
|
if (rtn == NSOKButton) {
|
||||||
filenames = [openpanel filenames];
|
filenames = [openpanel filenames];
|
||||||
dir = [[openpanel directory] cString];
|
path = [filenames objectAtIndex: 0];
|
||||||
dir = "";
|
|
||||||
path = va ("%s/%s", dir, [[filenames objectAtIndex: 0] cString]);
|
|
||||||
strcpy (path_projectinfo, path);
|
|
||||||
[self openProjectFile: path];
|
[self openProjectFile: path];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue