Exemplo n.º 1
0
static void PrepareModList( void )
/********************************/
{
    file_list   *list;
    mod_entry   *mod;
    mod_entry   *curr;
    libnamelist *blacklist;

    mod = Root->mods;
    for( list = Root->files; list != NULL; list = list->next_file ) {
        if( strcmp( list->file->name, mod->f.fname ) == 0 ) {
            SetupModule( &mod, list );
        } else if( mod->n.next_mod != NULL ) {
            if( FNAMECMPSTR( list->file->name, mod->n.next_mod->f.fname ) == 0 ) {
                mod->modinfo |= MOD_KILL;
                mod = mod->n.next_mod;
                SetupModule( &mod, list );
            }
        }
        if( mod == NULL ) {
            break;
        }
    }
    while( mod != NULL ) {
        mod->modinfo |= MOD_KILL;               // no match found
        mod = mod->n.next_mod;
    }
    blacklist = CalcLibBlacklist();
    mod = LibModules;
    while( mod != NULL ) {
        if( mod->f.fname == NULL ) {
            mod->modinfo |= MOD_KILL;
        } else if( !(mod->modinfo & MOD_VISITED) ) {
            list = AddObjLib( mod->f.fname, LIB_PRIORITY_MID );
            CheckNewFile( mod, list, 1);
            CheckBlacklist( list, blacklist );
            for( curr = mod->n.next_mod; curr != NULL; curr = curr->n.next_mod){
                if( curr->f.fname == mod->f.fname ) {
                    curr->f.source = list;
                    curr->modinfo |= MOD_VISITED;
                }
            }
            mod->f.source = list;
        }
        mod->modinfo &= ~MOD_VISITED;
        mod = mod->n.next_mod;
    }
    FreeList( SavedUserLibs );
    SavedUserLibs = NULL;
}
Exemplo n.º 2
0
static void SetupModule( mod_entry **mod, file_list *list )
/*********************************************************/
{
    char        *fname;
    mod_entry   *currmod;

    currmod = *mod;

    CheckNewFile( currmod, list, 0 );
    fname = currmod->f.fname;
    for( ;; ) {
        currmod->f.source = list;
        currmod = currmod->n.next_mod;
        if( currmod == NULL )
            break;
        if( currmod->f.fname != fname ) {
            break;
        }
    }
    *mod = currmod;
}
Exemplo n.º 3
0
// Check new files in given directory, updates the entry. New files
// are prepended to the given list and a new list is returned as 
// return value. Calls recursively itself for subdirectories.
bool CNewFilesChecker::FindNewFiles(const gchar *dirpath, CDirEntry *entry)
{
	bool retval = true;
	CDirEntry *child;

	GDir *dir = g_dir_open(dirpath, 0, NULL);
	if (dir) {
		const gchar *filename = g_dir_read_name(dir);
		while (filename && retval) {
			gchar *filepath = g_build_filename(dirpath, filename, NULL);
			if (!entry->Lookup(filename, &child)) {
				// New item
				if (m_Recursive && g_file_test(filepath, G_FILE_TEST_IS_DIR)) {
					// Recursive call for new subdirectories
					CDirEntry *child = entry->AddDir(filename);
					retval = FindNewFiles(filepath, child);
				} else 
				if (g_file_test(filepath, G_FILE_TEST_IS_REGULAR)) {
					// Test regular files
					bool try_again = FALSE;
					retval = CheckNewFile(filepath, &try_again);
					if (!try_again)
						entry->AddFile(filename);
				}
			} else {
				if (m_Recursive && child && g_file_test(filepath, G_FILE_TEST_IS_DIR)) {
					// Recursive call for old subdirectories
					retval = FindNewFiles(filepath, child);
				}
			}
			g_free(filepath);
			filename = g_dir_read_name(dir);
		}
		g_dir_close(dir);
	}
	return retval;
}