// $demoPath 不以 \ 结尾
#VAR $demoPath = #GetDemoPath();

// $installPath 以 \结尾
#VAR $installPath = #GetInstallPath();
#VAR $installPath_escape = #GetInstallPath_escape();
#VAR $cmd = $installPath + 'bin\\code ' + $demoPath;



#CreateDir($demoPath + '\.vscode');
#VAR $task = '{\n\t"version": "2.0.0",\n\t"tasks": [\n\t\t{\n\t\t\t"type": "cppbuild",\n\t\t\t"label": "C/C++: g++.exe build active file",\n\t\t\t"command": "' + $installPath_escape;
$task = $task + 'mingw64\\bin\\g++.exe",\n\t\t\t"args": [\n\t\t\t\t"-fdiagnostics-color=always",\n\t\t\t\t"-g",\n\t\t\t\t"${file}",\n\t\t\t\t"-o",\n\t\t\t\t"${fileDirname}\\${fileBasenameNoExtension}.exe",\n\t\t\t\t"-l",\n\t\t\t\t"easyx"\n\t\t\t],\n\t\t\t"options": {\n\t\t\t\t"cwd": "${fileDirname}"\n\t\t\t},\n\t\t\t"problemMatcher": ["$gcc"],\n\t\t\t"group": "build",\n\t\t\t"detail": "compiler:';
$task = $task + $installPath_escape;
$task = $task + 'mingw64\\bin\\g++.exe"\n\t\t}\n\t]\n}';
#CreateFile($demoPath + '\\.vscode\\tasks.json', $task);

#VAR $cppJson = '{\n\t"configurations": [\n\t\t{\n\t\t\t"name": "Win32",\n\t\t\t"includePath": ["${workspaceFolder}/**"],\n\t\t\t"browse": {\n\t\t\t\t"path":[\n\t\t\t\t\t"${workspaceRoot}",\n\t\t\t\t\t"';
$cppJson = $cppJson + $installPath_escape;
$cppJson = $cppJson + 'mingw64\\x86_64-w64-mingw32\\lib"\n\t\t\t\t]\n\t\t\t},\n\t\t\t"defines": ["_DEBUG","UNICODE","_UNICODE"],\n\t\t\t"compilerPath": "';
$cppJson = $cppJson + $installPath_escape;
$cppJson = $cppJson + 'mingw64\\bin\\g++.exe",\n\t\t\t"cStandard": "c17",\n\t\t\t"cppStandard": "gnu++14",\n\t\t\t"intelliSenseMode": "windows-gcc-x64"\n\t\t}\n\t],\n\t"version": 4\n}';
#CreateFile($demoPath + '\\.vscode\\c_cpp_properties.json', $cppJson);

#VAR $demo = '#include <graphics.h>\t\t// 引入图形库头文件\n\nint main()\n{\n\tinitgraph(600, 400);\t// 初始化绘图设备\n\tcircle(300, 200, 50);\t// 画圆\n\tgetmessage(EX_CHAR);\t// 按任意键继续\n\tclosegraph();\t\t\t// 关闭绘图设备\n\treturn 0;\n}';
#CreateFile($demoPath + '\demo.cpp', $demo);

// 使 Process.exe 输出 completed done end ok 之类的指令，由 MyWindow 检测并执行相关操作
#Done('state:config-vscode-done');