Example #1
0
static TCHAR *get_native_library_path (const TCHAR *library_name)
{
    write_log (_T("uni: find_native_library %s\n"), library_name);
    TCHAR path[PATH_MAX];
    const TCHAR **library_dirs = uaenative_get_library_dirs ();

    for (const TCHAR **dir = library_dirs; *dir != NULL; dir++) {
        // name must already have been checked to not contain anything
        // to allow access to parent directories.
        _sntprintf (path, PATH_MAX, _T("%s/%s-%s"), *dir, library_name,
                    MODULE_SUFFIX);
        write_log (_T("uni: checking %s\n"), path);
        if (my_existsfile (path)) {
            return my_strdup (path);
        }
#ifdef _WIN32
        // for compatibility with existing WinUAE native interface
        _sntprintf (path, PATH_MAX, _T("%s/%s.dll"), *dir, library_name);
        write_log (_T("uni: checking %s\n"), path);
        if (my_existsfile (path)) {
            return my_strdup (path);
        }
#endif
    }
    return NULL;
}
 void action(const gcn::ActionEvent& actionEvent)
 {
   if (actionEvent.getSource() == cmdOK)
   {
     int selected_item;
     selected_item = lstFiles->getSelected();
     if(createNew)
     {
       char tmp[MAX_PATH];
       if(txtFilename->getText().length() <= 0)
         return;
       strcpy(tmp, workingDir);
       strcat(tmp, "/");
       strcat(tmp, txtFilename->getText().c_str());
       if(strstr(tmp, filefilter[0]) == NULL)
         strcat(tmp, filefilter[0]);
       if(my_existsfile(tmp) == 1)
         return; // File already exists
       strcpy(workingDir, tmp);
       dialogResult = true;
     }
     else
     {
       if(fileList->isDir(selected_item))
         return; // Directory selected -> Ok not possible
       strcat(workingDir, "/");
       strcat(workingDir, fileList->getElementAt(selected_item).c_str());
       dialogResult = true;
     }
   }
   dialogFinished = true;
 }