Пример #1
0
void CFileListView::ExtractSelect()
{
	UInt32 nIndex;
	FileInfo *info = NULL;
	char szPath[MAX_PATH];

	if(m_pArchive == NULL)
		return;

	nIndex = GetCurrentSelected();
	if(nIndex < m_FileStack.back()->Chlids.size())
		info = &(m_FileStack.back()->Chlids[nIndex]);

	if(info != NULL)
	{
		if(info->nFileSize > 0)
		{
			GetCurrentFileName(nIndex, szPath, MAX_PATH);
			ExtractFile(szPath);
		}
		else
		{
			BROWSEINFO bi; 
			bi.hwndOwner      = m_hWnd;
			bi.pidlRoot       = NULL;
			bi.pszDisplayName = NULL; 
			bi.lpszTitle      = TEXT("请选择文件夹"); 
			bi.ulFlags        = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
			bi.lpfn           = NULL; 
			bi.lParam         = 0;
			bi.iImage         = 0; 

			LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
			if (pidl == NULL)
				return;

			if (SHGetPathFromIDList(pidl, szPath))
				ExtractFolder(info, NULL, szPath);
		}
	}
}
Пример #2
0
void CFileListView::ExtractFolder( FileInfo *pItem, const char* pCurrPath, const char *pSavePath )
{
	FileInfo *pSubItem;
	char szCurrPath[MAX_PATH];
	char szSavePath[MAX_PATH];
	char szPath[MAX_PATH];

	szCurrPath[0] = 0;
	if(pCurrPath && *pCurrPath)
	{
		strcat_s(szCurrPath, MAX_PATH, pCurrPath);
		strcat_s(szCurrPath, MAX_PATH, "\\");
	}
	strcat_s(szCurrPath, MAX_PATH, pItem->szName);

	sprintf_s(szSavePath, "%s\\%s", pSavePath, szCurrPath);
	if(!::CreateDirectory(szSavePath, NULL))
		return;

	for (size_t i=0; i<pItem->Chlids.size(); i++)
	{
		pSubItem = &(pItem->Chlids[i]);

		if(pSubItem->nFileSize > 0)
		{
			if(GetCurrentPath(szPath, MAX_PATH))
				strcat_s(szPath, MAX_PATH, "\\");

			strcat_s(szPath, MAX_PATH, szCurrPath);
			strcat_s(szPath, MAX_PATH, "\\");
			strcat_s(szPath, MAX_PATH, pSubItem->szName);

			sprintf_s(szSavePath, "%s\\%s\\%s", pSavePath, szCurrPath, pSubItem->szName);

			archive_extract_file(m_pArchive, szPath, szSavePath);
		}
		else
			ExtractFolder(pSubItem, szCurrPath, pSavePath);
	}
}
Пример #3
0
int main(int argc, char *argv[]) {
	if(argc < 2) {
		fprintf(stderr, "Error: input file missing\n");
		return -1;
	}

	char* module_folder = ExtractFolder(argv[1]);
	printf("Module folder of %s: %s\n", argv[1], module_folder);

	AddModulePath(module_folder);
	AddModulePath("./");

	IDTable *id_table = CreateIDTable();

	AST *ast = ParseFile(argv[1], id_table);
	DumpAST(ast);

	Scope *scope = CreateScope();
	InterpretAST(ast, scope, id_table);

	printf("\n");
	return 0;
}