3 /*static void ParseListValue(List<String> list, char * equal)
7 string = CopyString(equal);
11 comma = strstr(start, ",");
14 list.Add(CopyString(start));
24 enum OpenedFileState { unknown, opened, closed };
25 enum ValgrindLeakCheck
27 no, summary, yes, full;
31 get { return OnGetString(null, null, null); }
34 const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
36 if(this >= no && this <= full)
39 strcpy(tempString, valgrindLeakCheckNames[this]);
40 return valgrindLeakCheckNames[this];
42 if(tempString && tempString[0])
47 static const char * valgrindLeakCheckNames[ValgrindLeakCheck] = { "no", "summary", "yes", "full" };
55 OpenedFileState state;
56 int lineNumber, position;
60 property bool trackingAllowed
62 get { return !holdTracking && ide && ide.workspace && !ide.workspace.holdTracking; }
65 void CaretMove(int line, int charPos)
67 if(trackingAllowed && (line != lineNumber || position != charPos))
71 ide.workspace.modified = true;
75 void ScrollChange(Point scroll)
79 this.scroll.x = scroll.x;
80 this.scroll.y = scroll.y;
81 ide.workspace.modified = true;
89 List<OpenedFileInfo> files = ide.workspace.openedFiles;
90 Iterator<OpenedFileInfo> it { files };
91 if(it.Find(this) && it.pointer != files.GetLast())
93 files.Move(it.pointer, files.GetPrev(files.GetLast()));
94 ide.workspace.modified = true;
108 char * workspaceFile;
110 char * commandLineArgs;
111 property const char * commandLineArgs { set { delete commandLineArgs; if(value) commandLineArgs = CopyString(value); } }
113 property const char * debugDir { set { delete debugDir; if(value) debugDir = CopyString(value); } }
117 property const char * compiler
119 set { delete compiler; if(value && value[0]) compiler = CopyString(value); }
120 get { return compiler && compiler[0] ? compiler : null; }
123 List<String> sourceDirs { };
124 Array<NamedString> environmentVars { };
125 List<Breakpoint> breakpoints { };
126 List<Watch> watches { };
127 List<OpenedFileInfo> openedFiles { };
128 List<Project> projects { };
137 userData = this, delay = 2.5;
146 property const char * workspaceFile
150 char dir[MAX_DIRECTORY];
151 if(workspaceFile) delete workspaceFile;
152 if(workspaceDir) delete workspaceDir;
153 workspaceFile = CopyString(value);
154 StripLastDirectory(workspaceFile, dir);
155 workspaceDir = CopyUnixPath(dir);
157 get { return workspaceFile; }
160 property const char * projectDir
166 Project prj = projects.firstIterator.data;
167 return prj.topNode ? prj.topNode.path : null;
174 /*property Project project
184 projectDir = CopyString(project.topNode.path);
186 if(!project.config && activeConfig && activeConfig[0])
189 for(cfg = project.configurations.first; cfg; cfg = cfg.next)
190 if(!strcmp(cfg.name, activeConfig))
192 project.config = cfg;
195 project.config = project.configurations.first;
198 get { return project; }
204 // TODO: save these new settings when json format is ready
206 ValgrindLeakCheck vgLeakCheck;
211 vgLeakCheck = summary;
219 file = FileOpen(workspaceFile, write);
223 for(bp : breakpoints)
228 file.Printf("Breakpoint=1,%d,%s,%s\n", bp.line, bp.absoluteFilePath, bp.relativeFilePath);
230 file.Printf("Breakpoint=0,%d,%s,%s\n", bp.line, bp.absoluteFilePath, bp.relativeFilePath);
235 file.Printf("Watch=%s\n", wh.expression);
237 for(dir : sourceDirs)
238 file.Printf("SourceDir=%s\n", dir);
240 if(debugDir && debugDir[0])
241 file.Printf("DebugDir=%s\n", debugDir);
243 if(commandLineArgs && commandLineArgs[0])
244 file.Printf("CommandLineArgs=%s\n", commandLineArgs);
248 char indentation[128*3];
249 char path[MAX_LOCATION];
251 file.Printf("\nECERE Workspace File\n");
252 file.Printf("\nVersion 0.02\n");
253 file.Printf("\nWorkspace\n");
254 file.Printf("\n Active Compiler = %s\n", compiler ? compiler : defaultCompilerName);
255 file.Printf("\n Active Bit Depth = %d\n", bitDepth);
259 file.Printf("\n Projects\n\n");
262 char location[MAX_LOCATION];
263 MakePathRelative(prj.topNode.path, workspaceDir, location);
264 MakeSlashPath(location);
265 PathCatSlash(location, prj.topNode.name);
266 //strcat(location, ".epj");
268 file.Printf(" %s %s\n", "-", location);
271 file.Printf(" Active Configuration = %s\n", prj.config.name);
272 for(cfg : prj.configurations)
274 if(cfg.compilingModified)
275 file.Printf(" Modified Compiler Config = %s\n", cfg.name);
276 else if(cfg.linkingModified)
277 file.Printf(" Modified Linker Config = %s\n", cfg.name);
282 file.Printf("\n Execution Data\n");
283 if(commandLineArgs && commandLineArgs[0])
285 file.Printf("\n Command Line Arguments = ");
286 file.Puts(commandLineArgs);
290 if(environmentVars.count)
292 file.Printf("\n Environment Variables\n\n");
293 for(v : environmentVars)
303 file.Printf("\n Debugger Data\n");
304 // This really belonged in Execution Data...
305 if(debugDir && debugDir[0])
306 file.Printf("\n Debug Working Directory = %s\n", debugDir);
309 file.Printf("\n Source Directories\n");
310 for(dir : sourceDirs)
311 file.Printf(" = %s\n", dir);
314 for(bp : breakpoints)
321 file.Printf("\n Breakpoints\n\n");
329 file.Printf("\n Watches\n\n");
334 if(openedFiles.count)
336 file.Printf("\n Opened Files\n\n");
337 for(ofi : openedFiles)
341 char relativePath[MAX_LOCATION];
342 if(IsPathInsideOf(ofi.path, workspaceDir))
344 MakePathRelative(ofi.path, workspaceDir, relativePath);
345 MakeSlashPath(relativePath);
346 location = relativePath;
352 file.Printf(" %s %s:%d:%d:%d:%d:%s\n", chr, ofi.state == closed ? "C" : "O", ofi.lineNumber, ofi.position, ofi.scroll.x, ofi.scroll.y, location);
361 char * CopyAbsolutePathFromRelative(const char * relative)
363 char name[MAX_LOCATION];
364 char absolute[MAX_LOCATION];
366 ProjectNode node = null;
368 GetLastDirectory(relative, name);
371 if((node = p.topNode.Find(name, false)))
379 node.GetFullFilePath(absolute);
380 return CopyString(absolute);
386 strcpy(absolute, p.topNode.path);
387 PathCatSlash(absolute, relative);
388 if(FileExists(absolute))
395 return CopyString(absolute);
397 strcpy(absolute, workspaceDir); //projectDir // CHECK?
398 PathCatSlash(absolute, relative);
399 if(FileExists(absolute))
400 return CopyString(absolute);
403 for(dir : sourceDirs)
405 strcpy(absolute, dir);
406 PathCatSlash(absolute, relative);
407 if(FileExists(absolute))
408 return CopyString(absolute);
415 char * CopyUnixPathWorkspaceRelativeOrAbsolute(const char * path)
417 if(IsPathInsideOf(path, workspaceDir))
419 char relativePath[MAX_LOCATION];
420 MakePathRelative(path, workspaceDir, relativePath);
421 return CopyUnixPath(relativePath);
424 return CopyUnixPath(path);
427 char * MakeRelativePath(char * buffer, const char * path)
429 char * result = null;
432 MakePathRelative(path, workspaceDir, buffer);
433 MakeSlashPath(buffer);
439 char * GetRelativePathForProject(char * buffer, Project project)
441 char * result = null;
442 if(buffer && project && project.topNode.path)
444 MakePathRelative(project.topNode.path, workspaceDir, buffer);
445 MakeSlashPath(buffer);
446 PathCatSlash(buffer, project.topNode.name);
452 Array<ProjectNode> GetAllProjectNodes(const char *fullPath, bool skipExcluded)
454 Array<ProjectNode> nodes = null;
455 for(project : projects)
458 if((node = project.topNode.FindByFullPath(fullPath, false)))
460 if(!skipExcluded || !node.GetIsExcluded(project.config))
462 if(!nodes) nodes = { };
470 Project GetFileOwner(const char * absolutePath, const char * objectFileExt)
472 Project owner = null;
475 if(prj.topNode.FindByFullPath(absolutePath, false))
482 GetObjectFileNode(absolutePath, &owner, null, objectFileExt);
486 void GetRelativePath(const char * absolutePath, char * relativePath, Project * owner, const char * objectFileExt)
488 Project prj = GetFileOwner(absolutePath, objectFileExt);
492 prj = projects.firstIterator.data;
495 MakePathRelative(absolutePath, prj.topNode.path, relativePath);
496 MakeSlashPath(relativePath);
499 relativePath[0] = '\0';
502 ProjectNode GetObjectFileNode(const char * filePath, Project * project, char * fullPath, const char * objectFileExt)
504 ProjectNode node = null;
505 char ext[MAX_EXTENSION];
506 GetExtension(filePath, ext);
509 IntermediateFileType type = IntermediateFileType::FromExtension(ext);
512 char fileName[MAX_FILENAME];
513 GetLastDirectory(filePath, fileName);
516 DotMain dotMain = DotMain::FromFileName(fileName);
517 for(prj : ide.workspace.projects)
519 if((node = prj.FindNodeByObjectFileName(fileName, type, dotMain, null, objectFileExt)))
525 const char * cfgName = prj.config ? prj.config.name : "";
526 char name[MAX_FILENAME];
527 CompilerConfig compiler = ideSettings.GetCompilerConfig(prj.lastBuildCompilerName);
528 DirExpression objDir = prj.GetObjDir(compiler, prj.config, bitDepth);
529 strcpy(fullPath, prj.topNode.path);
530 PathCatSlash(fullPath, objDir.dir);
531 node.GetObjectFileName(name, prj.configsNameCollisions[cfgName], type, dotMain, objectFileExt);
532 PathCatSlash(fullPath, name);
545 OpenedFileInfo UpdateOpenedFileInfo(const char * fileName, OpenedFileState state)
547 char filePath[MAX_LOCATION];
548 OpenedFileInfo ofi = null;
549 GetSlashPathBuffer(filePath, fileName);
550 for(item : openedFiles)
552 if(!fstrcmp(item.path, filePath))
562 ofi = OpenedFileInfo { path = CopyString(filePath) };
563 openedFiles.Add(ofi);
571 Iterator<OpenedFileInfo> it { openedFiles };
573 openedFiles.Delete(it.pointer);
580 void UpdateSourceDirsArray(Array<String> dirs)
585 sourceDirs.Add(CopyString(s));
587 DropInvalidBreakpoints(null);
592 void RemoveProject(Project project)
594 Iterator<Project> it { projects };
598 for(bp : breakpoints)
599 DropInvalidBreakpoints(project);
601 ide.findInFilesDialog.RemoveProjectItem(project);
602 ide.UpdateToolBarActiveConfigs(false);
608 void SelectActiveConfig(const char * configName)
611 for(prj : ide.workspace.projects)
613 for(cfg : prj.configurations)
615 if(cfg.name && !strcmp(cfg.name, configName))
626 ide.UpdateToolBarActiveConfigs(true);
627 ide.projectView.Update(null);
630 ide.AdjustDebugMenus();
633 bool FindPath(ProjectNode node, const char * path)
635 if(node.type == file)
637 // TODO: Should this code be moved into a ProjectNode::absolutePath property? Taken from NodeProperties.ec
638 char filePath[MAX_LOCATION];
639 GetSlashPathBuffer(filePath, node.project.topNode.path);
640 PathCatSlash(filePath, node.path);
641 PathCatSlash(filePath, node.name);
643 if(!fstrcmp(filePath, path))
650 if(FindPath(n, path))
657 void ChangeBreakpoint(DataRow row, const char * location)
659 Breakpoint bp = (Breakpoint)(intptr)row.tag;
662 char * currentLoc = bp.CopyUserLocationString();
663 if(strcmp(location, currentLoc))
666 bp.location = location;
668 newLoc = bp.CopyUserLocationString();
669 if(strcmp(newLoc, currentLoc))
671 ide.breakpointsView.UpdateBreakpoint(row);
679 // adding a breakpoint by typing it in the breakpoints view
680 // todo, parse location
681 // if good, make add breakpoint, make sure possibly previously entered ignore and level are reflected in breakpoint
684 //bp = Breakpoint { };
685 //row.tag = (int64)bp;
686 //breakpoints.Add(bp);
692 void ChangeBreakpointIgnore(DataRow row, int ignore)
694 Breakpoint bp = (Breakpoint)(intptr)row.tag;
702 void ChangeBreakpointLevel(DataRow row, int level)
704 Breakpoint bp = (Breakpoint)(intptr)row.tag;
712 void ChangeBreakpointCondition(DataRow row, const char * condition)
714 Breakpoint bp = (Breakpoint)(intptr)row.tag;
715 if(bp && !(!bp.condition && !(condition && condition[0])))
719 bp.condition = Watch { };
720 bp.condition.expression = CopyString(condition);
723 else if(!(condition && condition[0]))
729 else if(strcmp(condition, bp.condition.expression))
732 bp.condition = Watch { };
733 bp.condition.expression = CopyString(condition);
739 void RemoveBreakpoint(Breakpoint bp)
742 ide.breakpointsView.RemoveBreakpoint(bp);
743 ide.debugger.UpdateRemovedBreakpoint(bp);
745 Iterator<Breakpoint> it { breakpoints };
747 breakpoints.Remove(it.pointer);
751 for(document = ide.firstChild; document; document = document.next)
753 const char * fileName = document.fileName;
754 if(document.isDocument && fileName && document.created)
756 char winFilePath[MAX_LOCATION];
757 const char * slashPath = GetSlashPathBuffer(winFilePath, fileName);
759 if(!fstrcmp(slashPath, bp.absoluteFilePath))
761 CodeEditor codeEditor = (CodeEditor)document;
762 int boxH = codeEditor.editBox.clientSize.h;
763 Box box { 0, 0, 19, boxH - 1 };
764 document.Update(box);
774 void ParseLoadedBreakpoints()
776 for(bp : breakpoints; bp.location)
779 ide.breakpointsView.UpdateBreakpoint(bp.row);
783 void DropInvalidBreakpoints(Project removedProject)
786 for(bpLink = breakpoints.first; bpLink; bpLink = next)
788 Breakpoint bp = (Breakpoint)(intptr)bpLink.data;
795 if(bp.project == removedProject)
797 ide.breakpointsView.RemoveBreakpoint(bp);
798 RemoveBreakpoint(bp);
803 Project project = bp.project;
808 if(FindPath(p.topNode, bp.absoluteFilePath))
813 // Handle symbol loader modules:
815 char moduleName[MAX_FILENAME];
817 GetLastDirectory(bp.absoluteFilePath, moduleName);
818 // Tweak for automatically resolving symbol loader modules
819 sl = strstr(moduleName, ".main.ec");
820 if(sl && (*sl = 0, !strcmpi(moduleName, p.name)))
831 for(dir : sourceDirs)
833 if(IsPathInsideOf(bp.absoluteFilePath, dir))
841 ide.breakpointsView.RemoveBreakpoint(bp);
842 RemoveBreakpoint(bp);
848 ide.breakpointsView.Update(null);
853 delete workspaceFile;
855 delete commandLineArgs;
867 ide.outputView.buildBox.Clear();
868 ide.outputView.debugBox.Clear();
869 ide.callStackView.Clear();
870 ide.watchesView.Clear();
871 ide.threadsView.Clear();
872 ide.breakpointsView.Clear();
874 property::debugDir = "";
876 SetSourceDirs(sourceDirs);
885 environmentVars.Free();
894 Workspace LoadWorkspace(const char * filePath, const char * fromProjectFile)
897 Workspace workspace = null;
899 file = FileOpen(filePath, read);
902 OldList openedFilesNotFound { };
905 char subSection[128];
907 workspace = Workspace { compiler = ideSettings.defaultCompiler, workspaceFile = filePath };
916 Breakpoint bp = null;
918 file.GetLine(buffer, 65536 - 1);
919 TrimLSpaces(buffer, buffer);
920 TrimRSpaces(buffer, buffer);
927 TrimLSpaces(equal, equal);
928 if(!strcmpi(section, "Debugger Data") && !strcmpi(subSection, "Watches"))
931 workspace.watches.Add(wh);
932 wh.expression = CopyString(equal);
934 else if(!strcmpi(section, "Debugger Data") && !strcmpi(subSection, "Breakpoints"))
939 wh.expression = CopyString(equal);
943 else if(!strcmpi(section, "Execution Data") && !strcmpi(subSection, "Environment Variables"))
945 String value = strchr(equal, '=');
950 TrimRSpaces(equal, equal);
951 TrimLSpaces(value, value);
952 workspace.environmentVars.Add({ equal, value });
956 else if(buffer[0] == '*')
960 TrimLSpaces(equal, equal);
961 if(!strcmpi(section, "Debugger Data") && !strcmpi(subSection, "Breakpoints"))
963 char * strEnabled = null;
964 char * strIgnore = null;
965 char * strLevel = null;
966 char * strLine = null;
967 char * strFile = null;
970 if(strEnabled && strEnabled[0])
972 strIgnore = strstr(strEnabled, ",");
976 if(strIgnore && strIgnore[0])
978 strLevel = strstr(strIgnore, ",");
982 if(strLevel && strLevel[0])
984 strLine = strstr(strLevel, ",");
988 if(strLine && strLine[0])
990 strFile = strstr(strLine, ",");
994 if(strEnabled && strEnabled[0] && strIgnore && strIgnore[0] &&
995 strLevel && strLevel[0] && strLine && strLine[0] && strFile && strFile[0])
1002 TrimLSpaces(strEnabled, strEnabled);
1003 TrimRSpaces(strEnabled, strEnabled);
1004 TrimLSpaces(strIgnore, strIgnore);
1005 TrimRSpaces(strIgnore, strIgnore);
1006 TrimLSpaces(strLevel, strLevel);
1007 TrimRSpaces(strLevel, strLevel);
1008 TrimLSpaces(strLevel, strLevel);
1009 TrimRSpaces(strLevel, strLevel);
1010 TrimLSpaces(strFile, strFile);
1011 TrimRSpaces(strFile, strFile);
1013 enabled = (strEnabled[0] == '1');
1014 ignore = atoi(strIgnore);
1015 level = atoi(strLevel);
1016 line = atoi(strLine);
1018 bp = { type = user, enabled = enabled, ignore = ignore, level = level, line = line };
1019 workspace.breakpoints.Add(bp);
1020 bp.location = strFile;
1024 else if(buffer[0] == '=' || buffer[0] == '-')
1028 TrimLSpaces(equal, equal);
1029 if(!strcmpi(section, "Debugger Data") && !strcmpi(subSection, "Source Directories"))
1030 workspace.sourceDirs.Add(CopyString(equal));
1031 else if(!strcmpi(section, "Opened Files"))
1033 OpenedFileState state = opened;
1037 char absolutePath[MAX_LOCATION];
1038 strcpy(absolutePath, workspace.workspaceDir);
1041 char * comma = strchr(equal, ',');
1045 lineNumber = atoi(equal);
1049 else if(version >= 0.02)
1051 char * column = strchr(equal, ':');
1055 if(strcmpi(equal, "O"))
1059 column = strchr(equal, ':');
1063 lineNumber = atoi(equal);
1066 column = strchr(equal, ':');
1070 position = atoi(equal);
1073 column = strchr(equal, ':');
1077 scroll.x = atoi(equal);
1080 column = strchr(equal, ':');
1084 scroll.y = atoi(equal);
1093 PathCatSlash(absolutePath, equal);
1095 if(state == closed || FileExists(absolutePath))
1096 workspace.openedFiles.Add(OpenedFileInfo { path = CopyString(absolutePath), state = state, lineNumber = lineNumber, position = position, scroll = scroll });
1098 openedFilesNotFound.Add(NamedItem { name = CopyString(equal) });
1100 else if(!strcmpi(section, "Projects"))
1102 char projectFilePath[MAX_LOCATION];
1104 strcpy(projectFilePath, workspace.workspaceDir);
1105 PathCatSlash(projectFilePath, equal);
1106 newProject = LoadProject(projectFilePath, null);
1109 workspace.projects.Add(newProject);
1110 newProject.StartMonitoring();
1112 else if(workspace.projects.count == 0)
1119 // TODO: show message or something when added project fails to load
1120 // http://ecere.com/mantis/view.php?id=524
1124 else if(!strcmpi(buffer, "ECERE Workspace File"));
1125 else if(!strcmpi(buffer, "Version 0a"))
1127 else if(!strncmp(buffer, "Version ", 8))
1128 version = atof(&buffer[8]);
1129 else if(!strcmpi(buffer, "Workspace"))
1130 strcpy(section, buffer);
1131 else if(!strcmpi(buffer, "Projects"))
1132 strcpy(section, buffer);
1133 else if(!strcmpi(buffer, "Execution Data"))
1134 strcpy(section, buffer);
1135 else if(!strcmpi(buffer, "Debugger Data"))
1136 strcpy(section, buffer);
1137 else if(!strcmpi(buffer, "Source Directories"))
1138 strcpy(subSection, buffer);
1139 else if(!strcmpi(buffer, "Breakpoints"))
1140 strcpy(subSection, buffer);
1141 else if(!strcmpi(buffer, "Watches"))
1142 strcpy(subSection, buffer);
1143 else if(!strcmpi(buffer, "Environment Variables"))
1144 strcpy(subSection, buffer);
1145 else if(!strcmpi(buffer, "Opened Files"))
1146 strcpy(section, buffer);
1147 else if(!strcmpi(buffer, "")) // | These two lines were commented out
1148 strcpy(subSection, buffer); // | Do they serve a purpose? They were there for copy paste when adding a new subsection
1151 equal = strstr(buffer, "=");
1154 if(!strcmpi(section, "Workspace"))
1157 TrimRSpaces(buffer, buffer);
1159 TrimLSpaces(equal, equal);
1160 if(!strcmpi(buffer, "Active Compiler"))
1162 CompilerConfig compiler = ideSettings.GetCompilerConfig(equal);
1164 workspace.compiler = defaultCompilerName;
1166 workspace.compiler = equal;
1169 if(!strcmpi(buffer, "Active Bit Depth"))
1171 int bitDepth = atoi(equal);
1172 if(!(bitDepth == 32 || bitDepth == 64))
1174 workspace.bitDepth = bitDepth;
1175 ide.toolBar.activeBitDepth.SelectRow(ide.toolBar.activeBitDepth.FindRow(bitDepth));
1178 else if(!strcmpi(section, "Execution Data"))
1181 TrimRSpaces(buffer, buffer);
1183 TrimLSpaces(equal, equal);
1184 if(!strcmpi(buffer, "Command Line Arguments"))
1185 workspace.commandLineArgs = equal;
1187 if(!strcmpi(buffer, "Environment Variables"))
1189 workspace.environmentVars.Free();
1190 delete workspace.environmentVars;
1191 workspace.environmentVars = { };
1195 else if(!strcmpi(section, "Debugger Data"))
1198 TrimRSpaces(buffer, buffer);
1200 TrimLSpaces(equal, equal);
1201 if(!strcmpi(buffer, "Debug Working Directory"))
1202 workspace.debugDir = equal;
1207 TrimRSpaces(buffer, buffer);
1209 TrimLSpaces(equal, equal);
1210 if(!strcmpi(buffer, "Active Configuration"))
1213 if(workspace.projects.last)
1215 prj = workspace.projects.lastIterator.data;
1216 for(cfg : prj.configurations)
1218 if(!strcmp(cfg.name, equal))
1226 else if(!strcmpi(buffer, "Modified Compiler Config") || !strcmpi(buffer, "Modified Linker Config"))
1229 if(workspace.projects.last)
1231 prj = workspace.projects.lastIterator.data;
1232 for(cfg : prj.configurations)
1234 if(!strcmp(cfg.name, equal))
1236 if(strstr(buffer, "Compiler"))
1237 cfg.compilingModified = true;
1239 cfg.linkingModified = true;
1245 else if(!strcmpi(buffer, "CommandLineArgs"))
1246 workspace.commandLineArgs = equal;
1247 else if(!strcmpi(buffer, "Breakpoint"))
1250 char * lineNum = strstr(equal, ",");
1261 char * absPath = strstr(lineNum, ",");
1268 char * relPath = strstr(absPath, ",");
1275 bp = { type = user, enabled = enabled, level = -1 };
1276 workspace.breakpoints.Add(bp);
1277 bp.line = atoi(lineNum);
1278 bp.location = relPath;
1286 else if(!strcmpi(buffer, "Watch"))
1289 workspace.watches.Add(wh);
1290 wh.expression = CopyString(equal);
1292 else if(!strcmpi(buffer, "SourceDir"))
1294 workspace.sourceDirs.Add(CopyString(equal));
1296 else if(!strcmpi(buffer, "DebugDir"))
1298 workspace.debugDir = equal;
1310 if(!workspace.projects.first)
1314 project = LoadProject(fromProjectFile /*projectFilePath*/, null);
1317 char projectFilePath[MAX_LOCATION];
1318 strcpy(projectFilePath, workspace.workspaceFile);
1319 ChangeExtension(projectFilePath, ProjectExtension, projectFilePath);
1320 project = LoadProject(projectFilePath, null);
1324 project.StartMonitoring();
1325 workspace.projects.Add(project);
1326 workspace.name = CopyString(project.name);
1330 MessageBox { type = ok, master = ide, contents = $"Workspace load file failed", text = $"Workspace Load File Error" }.Modal();
1336 if(openedFilesNotFound.first)
1340 String files = new char[MAX_LOCATION * 16];
1342 String msg = new char[MAX_LOCATION * 16 + 2048];
1346 item = openedFilesNotFound.first;
1350 for(item = openedFilesNotFound.first; item; item = item.next)
1355 strcat(files, "\n...");
1358 strcat(files, "\n");
1359 strcat(files, item.name);
1362 sprintf(title, $"File%s not found", s);
1363 sprintf(msg, $"The following file%s could not be re-opened.%s", s, files);
1365 MessageBox { type = ok, master = ide, contents = msg, text = title }.Modal();
1370 openedFilesNotFound.Free(OldLink::Free);
1373 openedFilesNotFound.Free(OldLink::Free);
1375 else if(fromProjectFile)
1377 //MessageBox { type = Ok, master = ide, contents = "Worspace load file failed", text = "Worspace Load File Error" }.Modal();
1378 //char projectFile[MAX_LOCATION];
1381 //strcpy(projectFile, filePath);
1382 //ChangeExtension(projectFile, ProjectExtension, projectFile);
1383 newProject = LoadProject(fromProjectFile /*projectFile*/, null);
1387 newProject.StartMonitoring();
1388 workspace = Workspace { workspaceFile = filePath };
1390 workspace.projects.Add(newProject);
1397 ide.ChangeFileDialogsDirectory(workspace.workspaceDir, false);
1399 if(!workspace.compiler || !workspace.compiler[0])
1400 workspace.compiler = defaultCompilerName;