コード例 #1
0
ファイル: OldFiles.cpp プロジェクト: 0vermind/NeoLoader
int Test_Date(wxString FileName)
{
    FN.Assign(FileName);
    if (!FN.FileExists())
    {
        ToShow+=FileName;
        ToShow+=__T(" does not exist");
        return -1;
    }
    if (!FN.GetTimes(&Access, NULL, NULL))
    {
        ToShow+=__T("Error getting date of ");
        ToShow+=FileName;
        return -1;
    }
    wxTimeSpan TS=wxDateTime::Now()-Access;
    if (TS.GetWeeks()>0 || TS.GetDays()>0 || TS.GetHours()>0 || TS.GetMinutes()>0)
    {
        ToShow+=FileName;
        ToShow+=__T(" is old : was compiled");
        ToShow+=TS.Format().c_str();
        ToShow+=__T(" ago\r\n");
    }
    return 0;
}
コード例 #2
0
ファイル: DirManager.cpp プロジェクト: ruthmagnus/audacity
bool DirManager::AssignFile(wxFileName &fileName,
			    wxString value,
                            bool diskcheck){
   wxFileName dir=MakeBlockFilePath(value);

   if(diskcheck){
      // verify that there's no possible collision on disk.  If there
      // is, log the problem and return FALSE so that MakeBlockFileName 
      // can try again

      wxDir checkit(dir.GetFullPath());
      if(!checkit.IsOpened()) return FALSE;
      
      // this code is only valid if 'value' has no extention; that
      // means, effectively, AssignFile may be called with 'diskcheck'
      // set to true only if called from MakeFileBlockName().
      
      wxString filespec;
      filespec.Printf(wxT("%s.*"),value.c_str());
      if(checkit.HasFiles(filespec)){
         // collision with on-disk state!
         wxString collision;
         checkit.GetFirst(&collision,filespec);
         
         wxLogWarning(_("Audacity found an orphaned blockfile %s! \nPlease consider saving and reloading the project to perform a complete project check.\n"),
                      collision.c_str());
         
         return FALSE;
      }
   }
   fileName.Assign(dir.GetFullPath(),value);
   return TRUE;
}
コード例 #3
0
// Fills in eventFileName appropriately based on whether the
// event was on a file or a directory.
static void FileNameFromEvent(wxFileName& eventFileName, char* path,
    FSEventStreamEventFlags flags)
{
    wxString strPath(path);
    if ( flags & kFSEventStreamEventFlagItemIsFile )
    {
        eventFileName.Assign(strPath);
    }
    if ( flags & kFSEventStreamEventFlagItemIsDir )
    {
        eventFileName.AssignDir(strPath);
    }
}
コード例 #4
0
ファイル: ArtDrvSim.cpp プロジェクト: MarekTP/wxAstroCapture
// checks if the image file exists in UserData or current dir
// returns true if the file exists and the simName is containing the filename
bool ArtDrvSim::CheckSimFile(wxFileName &simName, unsigned short Device)
{
   // look for sim files in GetUserDataDir()
   // Return the directory for the user-dependent application data files:
   // Unix: ~/.appname
   // Windows: C:\Documents and Settings\username\Application Data\appname
   wxStandardPaths px;
   // if we did not found a file we check the current dir for compatibility reasons
   switch (Device) {
   case ACT_Art429:
      simName.Assign(px.GetUserDataDir(), wxT(ART429_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      simName.Assign(wxT("."), wxT(ART429_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      break;
   case ACT_Art285:
      simName.Assign(px.GetUserDataDir(), wxT(ART285_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      simName.Assign(wxT("."), wxT(ART285_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      break;
   case ACT_Art424:
      simName.Assign(px.GetUserDataDir(), wxT(ART424_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      simName.Assign(wxT("."), wxT(ART424_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      break;
   case ACT_Art415:
      simName.Assign(px.GetUserDataDir(), wxT(ART415_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      simName.Assign(wxT("."), wxT(ART415_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      break;
   case ACT_Art4021:
      simName.Assign(px.GetUserDataDir(), wxT(ART4021_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      simName.Assign(wxT("."), wxT(ART4021_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      break;
   case ACT_Art11002:
      simName.Assign(px.GetUserDataDir(), wxT(ART11002_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      simName.Assign(wxT("."), wxT(ART11002_FILE), wxT("raw"));
      if (simName.IsOk()) if (simName.FileExists()) return true;
      break;
   default:
      ;
   }// switch
   simName.Clear();
   return false;
}