Index: trunk/abdev/BasicCompiler32/BasicCompiler.vcproj
===================================================================
--- trunk/abdev/BasicCompiler32/BasicCompiler.vcproj	(revision 164)
+++ trunk/abdev/BasicCompiler32/BasicCompiler.vcproj	(revision 165)
@@ -48,5 +48,5 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\jenga\include\common;..\..\cpplibs\boost;..\BasicCompiler_Common\include"
+				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost;..\BasicCompiler_Common\include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;JPN"
 				MinimalRebuild="true"
@@ -149,5 +149,5 @@
 				InlineFunctionExpansion="2"
 				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\jenga\include\common;..\..\cpplibs\boost;..\BasicCompiler_Common\include"
+				AdditionalIncludeDirectories="..\..\;..\..\cpplibs\boost;..\BasicCompiler_Common\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN"
 				StringPooling="true"
@@ -1453,4 +1453,8 @@
 				>
 				<File
+					RelativePath="..\BasicCompiler_Common\include\option.h"
+					>
+				</File>
+				<File
 					RelativePath="..\BasicCompiler_Common\include\Smoothie.h"
 					>
Index: trunk/abdev/BasicCompiler32/MakePeHdr.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/MakePeHdr.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler32/MakePeHdr.cpp	(revision 165)
@@ -1,2 +1,4 @@
+#include <jenga/include/common/Environment.h>
+
 #include "../BasicCompiler_Common/common.h"
 #include "Opcode.h"
@@ -342,5 +344,5 @@
 #ifdef _DEBUG
 	{
-		ofstream ofs( ( (string)BasicSystemDir + "middle_code.txt" ).c_str() );
+		ofstream ofs( ( Jenga::Common::Environment::GetAppDir() + "\\middle_code.txt" ).c_str() );
 		ofs << basbuf << endl;
 		ofs.close();
@@ -1155,7 +1157,7 @@
 	char *DosStubBuffer;
 	int DosStubSize;
-	extern char BasicSystemDir[MAX_PATH];
-	sprintf(temporary,"%sSubOperation\\dosstub.pgm",BasicSystemDir);
-	hFile=CreateFile(temporary,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	hFile=CreateFile(
+		( Jenga::Common::Environment::GetAppDir() + "\\SubOperation\\dosstub.pgm" ).c_str(),
+		GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 	if(hFile==INVALID_HANDLE_VALUE){
 		MessageBox(hOwnerEditor,"dosstub.pgmの読み込みに失敗","error",MB_OK);
Index: trunk/abdev/BasicCompiler_Common/BasicCompiler.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/BasicCompiler.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/BasicCompiler.cpp	(revision 165)
@@ -1,2 +1,5 @@
+#include <jenga/include/common/logger.h>
+#include <jenga/include/common/Environment.h>
+
 #include "BasicCompiler.h"
 
@@ -221,6 +224,7 @@
 			}
 
-			sprintf(temporary,"%spgm.tmp",BasicSystemDir);
-			hFile=CreateFile(temporary,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_TEMPORARY,NULL);
+			hFile=CreateFile(
+				( Jenga::Common::Environment::GetAppDir() + "\\pgm.tmp" ).c_str(),
+				GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_TEMPORARY,NULL);
 			WriteFile(hFile,FileName,lstrlen(FileName),&dw,NULL);
 			CloseHandle(hFile);
@@ -750,6 +754,7 @@
 		HANDLE hFile;
 		DWORD dwAccessBytes;
-		sprintf(temporary,"%spgm.tmp",BasicSystemDir);
-		hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+		hFile=CreateFile(
+			( Jenga::Common::Environment::GetAppDir() + "\\pgm.tmp" ).c_str(),
+			GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 		if(hFile!=INVALID_HANDLE_VALUE){
 			ReadFile(hFile,temporary,MAX_PATH,&dwAccessBytes,NULL);
Index: trunk/abdev/BasicCompiler_Common/BreakPoint.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/BreakPoint.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/BreakPoint.cpp	(revision 165)
@@ -1,2 +1,4 @@
+#include <jenga/include/common/Environment.h>
+
 #include "common.h"
 
@@ -93,18 +95,10 @@
 	num=0;
 
-
-	HANDLE hFile;
-	char temporary[MAX_PATH];
-	GetTempPath(MAX_PATH,temporary);
-	if(temporary[lstrlen(temporary)-1]!='\\') lstrcat(temporary,"\\");
-	lstrcat(temporary,"ab_breakpoint.tmp");
-
-	//未完成
-	sprintf(temporary,"%sab_breakpoint.tmp",BasicSystemDir);
-
 	char *buffer;
 	buffer=(char *)HeapAlloc(hHeap,0,65535);
 
-	hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	HANDLE hFile=CreateFile(
+		( Jenga::Common::Environment::GetAppDir() + "\\ab_breakpoint.tmp" ).c_str(),
+		GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 	if(hFile!=INVALID_HANDLE_VALUE){
 		DWORD dwAccBytes;
@@ -124,4 +118,5 @@
 		while(buffer[i]!='\n'&&buffer[i]!='\0'){
 			//行番号
+			char temporary[1024];
 			i=GetOneParameter(buffer,i,temporary);
 			i2=atoi(temporary);
Index: trunk/abdev/BasicCompiler_Common/Debug.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/Debug.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/Debug.cpp	(revision 165)
@@ -25,5 +25,5 @@
 	dwStepRun=2;
 }
-char *ReadBuffer_NonErrMsg(char *path);
+
 void Debugger_StepCursor(void){
 	char temporary[MAX_PATH];
Index: trunk/abdev/BasicCompiler_Common/NonVolatile.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/NonVolatile.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/NonVolatile.cpp	(revision 165)
@@ -1,6 +1,8 @@
+#include <jenga/include/common/Environment.h>
+
 #include "../BasicCompiler_Common/common.h"
 
 
-char *ReadBuffer_NonErrMsg(char *path){
+char *ReadBuffer_NonErrMsg( const string &path ){
 	extern HANDLE hHeap;
 	int i;
@@ -9,5 +11,5 @@
 	HANDLE hFile;
 
-	hFile=CreateFile(path,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+	hFile=CreateFile(path.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 	if(hFile==INVALID_HANDLE_VALUE) return 0;
 	i=GetFileSize(hFile,0);
@@ -18,9 +20,9 @@
 	return buffer;
 }
-_int8 WriteBuffer(char *path,char *buffer,int length){
+_int8 WriteBuffer( const string &path, char *buffer,int length){
 	extern HWND hOwnerEditor;
 	HANDLE hFile;
 	DWORD dw;
-	hFile=CreateFile(path,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
+	hFile=CreateFile(path.c_str(),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
 	if(hFile==INVALID_HANDLE_VALUE){
 		char temporary[MAX_PATH];
@@ -101,11 +103,7 @@
 	extern HANDLE hHeap;
 	int i;
-	char temporary[MAX_PATH];
 
 	//開く
-	extern char BasicSystemDir[MAX_PATH];
-	sprintf(temporary,"%sUserSetting\\compiler.ini",BasicSystemDir);
-
-	buffer=ReadBuffer_NonErrMsg(temporary);
+	buffer=ReadBuffer_NonErrMsg( Jenga::Common::Environment::GetAppDir() + "\\UserSetting\\compiler.ini" );
 	if(!buffer){
 		//レジストリを読み込む
@@ -137,4 +135,5 @@
 	ppWatchStr=(char **)HeapAlloc(hHeap,0,WatchNum*sizeof(char *)+1);
 	for(i=0;i<WatchNum;i++){
+		char temporary[VN_SIZE];
 		sprintf(temporary,"Watch%03d",i);
 
@@ -248,13 +247,12 @@
 	char temporary[MAX_PATH];
 
-	extern char BasicSystemDir[MAX_PATH];
-	sprintf(temporary,"%sUserSetting",BasicSystemDir);
+	const string userSettingDirPath = Jenga::Common::Environment::GetAppDir() + "\\UserSetting";
 
 	HANDLE hFind;
 	WIN32_FIND_DATA wfd;
-	hFind=FindFirstFile(temporary,&wfd);
+	hFind=FindFirstFile( userSettingDirPath.c_str() ,&wfd);
 	if(hFind==INVALID_HANDLE_VALUE){
 		//UserSettingディレクトリを作成
-		if(!CreateDirectory(temporary,NULL)){
+		if(!CreateDirectory( userSettingDirPath.c_str() ,NULL)){
 			extern HWND hOwnerEditor;
 			MessageBox(hOwnerEditor,"UserSettingディレクトリの作成に失敗","ActiveBasic",MB_OK|MB_ICONEXCLAMATION);
@@ -287,7 +285,7 @@
 
 	//保存
-	extern char BasicSystemDir[MAX_PATH];
-	sprintf(temporary,"%sUserSetting\\compiler.ini",BasicSystemDir);
-	WriteBuffer(temporary,buffer,lstrlen(buffer));
+	WriteBuffer(
+		userSettingDirPath + "\\compiler.ini",
+		buffer,lstrlen(buffer));
 
 
Index: trunk/abdev/BasicCompiler_Common/NonVolatile.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/NonVolatile.h	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/NonVolatile.h	(revision 165)
@@ -1,4 +1,4 @@
 
-char *ReadBuffer_NonErrMsg(char *path);
+char *ReadBuffer_NonErrMsg( const string &path );
 
 class CNonVolatile{
Index: trunk/abdev/BasicCompiler_Common/ParamImpl.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/ParamImpl.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/ParamImpl.cpp	(revision 165)
@@ -1,2 +1,4 @@
+#include <jenga/include/common/logger.h>
+
 #include "common.h"
 
Index: trunk/abdev/BasicCompiler_Common/common.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/common.h	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/common.h	(revision 165)
@@ -1,4 +1,6 @@
 //#define _CRT_SECURE_NO_DEPRECATE
 #pragma warning(disable : 4996)
+
+#include <option.h>
 
 #include <windows.h>
@@ -41,15 +43,4 @@
 
 
-//バージョン
-#define MAJOR_VER		5
-#define MINOR_VER		00
-#define REVISION_VER	00
-
-#ifdef _AMD64_
-#define VER_INFO		"(x64) (rev.280)"
-#else
-#define VER_INFO		"(rev.280)"
-#endif
-
 #if defined(JPN)
 //日本語
@@ -153,7 +144,4 @@
 #define EXE_HEADER_SIZE	0x1000
 
-
-// ログ生成を行うためのクラス
-#include <logger.h>
 
 // クラス管理用のクラス
Index: trunk/abdev/BasicCompiler_Common/error.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/error.cpp	(revision 164)
+++ trunk/abdev/BasicCompiler_Common/error.cpp	(revision 165)
@@ -1,2 +1,4 @@
+#include <jenga/include/common/logger.h>
+
 #include "../BasicCompiler_Common/common.h"
 
Index: trunk/abdev/BasicCompiler_Common/include/option.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/include/option.h	(revision 165)
+++ trunk/abdev/BasicCompiler_Common/include/option.h	(revision 165)
@@ -0,0 +1,33 @@
+/////////////////////////////////////////////////////////////////////
+// コンパイル オプション
+/////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////
+// ここから
+
+// バージョン
+#define MAJOR_VER		5
+#define MINOR_VER		00
+#define REVISION_VER	00
+
+// バージョン付加文字列
+#ifdef _AMD64_
+#define VER_INFO		"(x64) (rev.280)"
+#else
+#define VER_INFO		"(rev.280)"
+#endif
+
+// ログ生成しない場合はこの下の行をコメントアウトする
+#define USE_TRACE
+
+
+// ここまで
+/////////////////////////////
+
+
+#ifdef USE_TRACE
+#define trace(s) Jenga::Common::logger << s << endl
+#else
+#define trace(s)
+#endif
