コード例 #1
0
std::string ShaderFactory::getFullFileName(std::string fileName, GLenum shaderType)
{
	//char cpath[200];
	std::string fullName = "..\\Comp477Project\\Assets\\Shaders\\";
	//const char* cstr = fullName.c_str();
	//std::string fullPath=_fullpath(cpath, cstr, 200);
	
	fullName += getFolderName(shaderType);
	fullName += fileName;
	fullName += ".txt";
	return fullName;
}
コード例 #2
0
void ProjectPanel::addFilesFromDirectory(HTREEITEM hTreeItem)
{
    if (_selDirOfFilesFromDirDlg == TEXT("") && _workSpaceFilePath != TEXT(""))
    {
        TCHAR dir[MAX_PATH];
        lstrcpy(dir, _workSpaceFilePath.c_str());
        ::PathRemoveFileSpec(dir);
        _selDirOfFilesFromDirDlg = dir;
    }
    generic_string dirPath;
    if (_selDirOfFilesFromDirDlg != TEXT(""))
        dirPath = getFolderName(_hSelf, _selDirOfFilesFromDirDlg.c_str());
    else
        dirPath = getFolderName(_hSelf);

    if (dirPath != TEXT(""))
    {
        recursiveAddFilesFrom(dirPath.c_str(), hTreeItem);
        _treeView.expand(hTreeItem);
        setWorkSpaceDirty(true);
        _selDirOfFilesFromDirDlg = dirPath;
    }
}
コード例 #3
0
STDMETHODIMP_(ULONG) CMAPIAdviseSink::OnNotify(ULONG cNotif, LPNOTIFICATION lpNotifications)
{
	(void) cNotif;
	ULONG notification_type = lpNotifications->ulEventType;

	// log only messages created or moved
	if (notification_type != fnevObjectCreated && notification_type != fnevObjectMoved ) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [uninteresting notification] ", 5, FALSE);
		return S_OK;
	}
	
	DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [notification] ", 5, FALSE);
	
	if ( lpNotifications->info.obj.ulObjType != MAPI_MESSAGE ) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [not for a message, ignoring] ", 5, FALSE);
		return S_OK;
	}
	
#if DEBUG
	if (notification_type == fnevObjectCreated) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [new message] ", 5, FALSE);
	} else {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [moved message] ", 5, FALSE);
	}
#endif
	
	OBJECT_NOTIFICATION* obj = &lpNotifications->info.obj;
	HRESULT hRes = E_FAIL;
	
	/* open the message */
	LPMESSAGE lpMsg = openMessage( m_pStore, obj->cbEntryID, obj->lpEntryID);
	if (lpMsg == NULL) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR cannot open message]", 5, FALSE);
		return S_OK;
	}
	
	std::auto_ptr<MAPIMessage> message;
	message.reset(new MAPIMessage(lpMsg));
	
	/* set folder */
	LPWSTR folderName = getFolderName(m_pStore, obj->cbParentID, obj->lpParentID);
	message->SetFolder( folderName );
	
	/* parse the message*/
	if ( FAILED( message->Parse(REALTIME) ) ) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR parsing message]", 5, FALSE);
		return S_OK;
	}
	
#if DEBUG
	if (message->isMail()) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [Mail message]", 5, FALSE);
	} else if (message->isSMS()) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [SMS message]", 5, FALSE);
	} else if (message->isMMS()) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [MMS message]", 5, FALSE);
	}
#endif
	
	if ( message->isMail() ) {
		/* if this is a MAIL message, it MUST have a body */	
		if ( ! message->hasBody() ) {
			DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR does not have a body]", 5, FALSE);
			return S_OK;
		}
		
		/* me get moved mail only if we are in Sent Mail box */
		if ( notification_type == fnevObjectMoved ) {
			if ( ! isSentMailBox(m_pStore, obj->cbParentID, obj->lpParentID) ) {
				DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR folder is not Sent Mail]", 5, FALSE);
				return S_OK;
			}
		}
	} else if ( message->isSMS() ) {
		/* we get SMSs only upon creation */
		if (notification_type != fnevObjectCreated && notification_type != fnevObjectMoved) {
			DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR SMS moved, ignoring]", 5, FALSE);
			return S_OK;
		}

		/* check if SMS data is consistent */
		if (message->From() == message->To()) {
			DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR message from local to local, ignoring]", 5, FALSE);
			return S_OK;
		}
	}
	
	if ( ! LogMessage(*message) ) {
		DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [ERROR message not logged]", 5, FALSE);
		return S_OK;
	}
	
	DBG_TRACE(L"Debug - MAPIAdviseSink.cpp - OnNotify() [message logged!]", 5, FALSE);

	return S_OK;
}
コード例 #4
0
void AdministrationConfigDialog::updateUI()
{
  m_logLevel.setSignedInt(m_config->getLogLevel());

  m_useControlAuth.check(m_config->isControlAuthEnabled());

  ConfigDialog *configDialog = (ConfigDialog *)m_parentDialog;

  StringStorage logPath;

  m_config->getLogFilePath(&logPath);

  if (logPath.isEmpty()) {
    logPath.setString(StringTable::getString(IDS_LOGPATH_UNAVALIABLE));
    m_openLogPathButton.setEnabled(false);
    m_logPathTB.setEnabled(false);
  }

  m_logPathTB.setText(logPath.getString());

  StringStorage folder;
  getFolderName(logPath.getString(), &folder);
  HANDLE hDoc = CreateFile(folder.getString(), GENERIC_READ,
                           FILE_SHARE_READ, 0, OPEN_EXISTING,
                           FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, 0);
  if (hDoc == INVALID_HANDLE_VALUE) {
    m_openLogPathButton.setEnabled(false);
  } else {
    CloseHandle(hDoc);
    m_openLogPathButton.setEnabled(true);
  }

  for (int i = 0; i < 5; i++) {
    m_shared[0].check(false);
  }

  if (m_config->isAlwaysShared() && !m_config->isNeverShared() && !m_config->isDisconnectingExistingClients()) {
    m_shared[0].check(true);
  }
  if (!m_config->isAlwaysShared() && m_config->isNeverShared() && !m_config->isDisconnectingExistingClients()) {
    m_shared[1].check(true);
  }
  if (!m_config->isAlwaysShared() && m_config->isNeverShared() && m_config->isDisconnectingExistingClients()) {
    m_shared[2].check(true);
  }
  if (!m_config->isAlwaysShared() && !m_config->isNeverShared() && !m_config->isDisconnectingExistingClients()) {
    m_shared[3].check(true);
  }
  if (!m_config->isAlwaysShared() && !m_config->isNeverShared() && m_config->isDisconnectingExistingClients()) {
    m_shared[4].check(true);
  }

  for (int i = 0; i < 3; i++) {
    m_disconnectAction[i].check(false);
  }
  switch (m_config->getDisconnectAction()) {
  case ServerConfig::DA_DO_NOTHING:
    m_disconnectAction[0].check(true);
    break;
  case ServerConfig::DA_LOCK_WORKSTATION:
    m_disconnectAction[1].check(true);
    break;
  case ServerConfig::DA_LOGOUT_WORKSTATION:
    m_disconnectAction[2].check(true);
    break;
  }

  m_logForAllUsers.check(m_config->isSaveLogToAllUsersPathFlagEnabled());

  if (m_config->hasControlPassword()) {
    unsigned char cryptedPassword[8];

    m_config->getControlPassword(cryptedPassword);

    m_cpControl->setCryptedPassword((char *)cryptedPassword);
  }

  m_cpControl->setEnabled(m_config->isControlAuthEnabled());
}
コード例 #5
0
ファイル: main.c プロジェクト: Socolcol/Splitter
void moveFiles(char* srcFolder, char* destFolder)
{
     // Opens the current dir
    DIR* pDir = opendir (srcFolder);
    struct dirent *pDirent;

    if (pDir == NULL)
    {
        printf ("Cannot open directory: '%s'\n", srcFolder);
        exit(1);
    }

    // Writes all the file names in this dir, into the file
    while ((pDirent = readdir(pDir)) != NULL)
    {
        char* fileName = pDirent->d_name;

         //Makes sure it doesn't write stuff like "." or ".." into the file
        if((strcmpi(fileName,".") != 0) && (strcmpi(fileName,"..") != 0))
        {
            //Creates the complete path (E.g. from C:\folder goes to c:\folder\something)
            char* completePath = buildFullPath(srcFolder,fileName);

            // If it's a file, not a folder
            if (!isDirectory(completePath))
            {
                char* folderName = getFolderName(fileName);
                char* folderPath = concatenate(destFolder,folderName);
                char* destPath = concatenate(folderPath,fileName);
                 strreplace(folderPath,'/','\\');

                DIR* dir = opendir(folderPath);

                if (dir)
                {
                    closedir(dir);
                }
                else
                {
                    char mdCommand[256];
                    sprintf(mdCommand,"md \"%s\"",folderPath);
                    system(mdCommand);
                }

                //printf("\nrename %s %s\n", completePath, concatenate(folderPath,fileName));

                if (fileExists(destPath))
                {
                    remove(destPath);
                }

                rename(completePath,destPath);
            }
            else
            {
                strcat(completePath,"\\");
                moveFiles(completePath, destFolder);
            }
        }
    }

    //Closes the dir and the file
    closedir (pDir);
}
コード例 #6
0
ファイル: TestsPath.hpp プロジェクト: questor/git-ws
SSVUT_TEST(PathTests)
{
	using namespace std;
	using namespace ssvu;
	using namespace ssvu::FileSystem;

	Path path{"/usr"};
	if(path.exists<ssvufs::Type::Folder>())
	{
		SSVUT_EXPECT_OP(path.getStr(), ==, "/usr/");
		SSVUT_EXPECT_OP(path.getFolderName(), ==, "usr");
	}

	path = "/usr.txt";
	SSVUT_EXPECT(path.getStr() == "/usr.txt");
	SSVUT_EXPECT(path.getFolderName() == "");

	path = "/usr.txt/banana/.log";
	SSVUT_EXPECT(path.getStr() == "/usr.txt/banana/.log");
	SSVUT_EXPECT(path.getParent().getFolderName() == "banana");
	SSVUT_EXPECT(path.getExtension() == "");
	SSVUT_EXPECT(path.getAllExtensions() == "");
	SSVUT_EXPECT(path.getFileName() == ".log");
	SSVUT_EXPECT(path.getFileNameNoExtensions() == ".log");

	path = "///////////usr//////";
	SSVUT_EXPECT(path.getStr() == "/usr/");
	SSVUT_EXPECT(path.getFolderName() == "usr");

	path = "/////\\//\\usr///\\//test//test2/////test4.png";
	SSVUT_EXPECT(path.getStr() == "/usr/test/test2/test4.png");