Subversion Repositories spk

Rev

Rev 134 | Rev 160 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 134 Rev 158
Line 52... Line 52...
52
			// match the same filetype
52
			// match the same filetype
53
			if ( of->GetFileType() != f->GetFileType() )
53
			if ( of->GetFileType() != f->GetFileType() )
54
				continue;
54
				continue;
55
 
55
 
56
			// same file
56
			// same file
57
			if ( of->GetFilename().Compare(f->GetFilename()) )
57
			if ( of->filename().Compare(f->filename()) )
58
				_storeOverride(f);
58
				_storeOverride(f);
59
		}
59
		}
60
	}
60
	}
61
}
61
}
62
 
62
 
Line 75... Line 75...
75
			// match the same filetype
75
			// match the same filetype
76
			if ( of->GetFileType() != f->GetFileType() )
76
			if ( of->GetFileType() != f->GetFileType() )
77
				continue;
77
				continue;
78
 
78
 
79
			// same file
79
			// same file
80
			if ( of->GetFilename().Compare(f->GetFilename()) )
80
			if ( of->filename().Compare(f->filename()) )
81
			{
81
			{
82
				// check if original file already exists (assume already backed up)
82
				// check if original file already exists (assume already backed up)
83
				if ( !backupFile(of, errors) )
83
				if ( !backupFile(of, errors) )
84
					continue;
84
					continue;
85
				break;
85
				break;
Line 90... Line 90...
90
 
90
 
91
bool COriginalFiles::backupFile(C_File *f, CyStringList *errors)
91
bool COriginalFiles::backupFile(C_File *f, CyStringList *errors)
92
{
92
{
93
	Utils::String newDir = "PluginManager/Original/" + f->getDirectory(NULL);
93
	Utils::String newDir = "PluginManager/Original/" + f->getDirectory(NULL);
94
	CDirIO oDir(_sDir);
94
	CDirIO oDir(_sDir);
95
	if ( oDir.exists(newDir + "/" + f->GetFilename().ToString()) )
95
	if ( oDir.exists(newDir + "/" + f->filename()) )
96
		return true;
96
		return true;
97
 
97
 
98
	// make sure the directory exissts
98
	// make sure the directory exissts
99
	if ( !oDir.exists(newDir) )
99
	if ( !oDir.exists(newDir) )
100
	{
100
	{
Line 109... Line 109...
109
		AddLogEntry(SPKINSTALL_CREATEDIRECTORY, newDir, errors);
109
		AddLogEntry(SPKINSTALL_CREATEDIRECTORY, newDir, errors);
110
	}
110
	}
111
 
111
 
112
	// now lets copy the file
112
	// now lets copy the file
113
	CFileIO CopyFile(f->filePointer());
113
	CFileIO CopyFile(f->filePointer());
114
	if ( CopyFile.copy(oDir.File(newDir + "/" + f->GetFilename().ToString()).ToString()) )
114
	if(CopyFile.copy(oDir.file(newDir + "/" + f->filename())))
115
	{
115
	{
116
		CLog::logf(CLog::Log_Install, 2, "Original file: %s has been backed up", f->GetNameDirectory(NULL).c_str());
116
		CLog::logf(CLog::Log_Install, 2, "Original file: %s has been backed up", f->GetNameDirectory(NULL).c_str());
117
		AddLogEntry(SPKINSTALL_ORIGINAL_BACKUP, f->GetNameDirectory(NULL), errors);
117
		AddLogEntry(SPKINSTALL_ORIGINAL_BACKUP, f->GetNameDirectory(NULL), errors);
118
		return true;
118
		return true;
119
	}
119
	}
Line 232... Line 232...
232
		for ( CListNode<C_File> *node = _lFiles.Front(); node; node = node->next() )
232
		for ( CListNode<C_File> *node = _lFiles.Front(); node; node = node->next() )
233
		{
233
		{
234
			C_File *uf = node->Data();
234
			C_File *uf = node->Data();
235
			Utils::String uString = "Original: ";
235
			Utils::String uString = "Original: ";
236
			uString += Utils::String::Number((long)uf->GetFileType()) + " ";
236
			uString += Utils::String::Number((long)uf->GetFileType()) + " ";
237
			uString += uf->GetFilename().ToString();
237
			uString += uf->filename();
238
 
238
 
239
			// add the directory for Extra files
239
			// add the directory for Extra files
240
			if ( uf->GetFileType() == FILETYPE_EXTRA && !uf->GetDir().Empty())
240
			if ( uf->GetFileType() == FILETYPE_EXTRA && !uf->GetDir().Empty())
241
			{
241
			{
242
				uString += ":";
242
				uString += ":";
Line 311... Line 311...
311
		// not of the same file type
311
		// not of the same file type
312
		if ( of->GetFileType() != file->GetFileType() )
312
		if ( of->GetFileType() != file->GetFileType() )
313
			continue;
313
			continue;
314
 
314
 
315
		// same file name, must be the same file
315
		// same file name, must be the same file
316
		if ( of->GetFilename().Compare(file->GetFilename()) )
316
		if ( of->filename().Compare(file->filename()) )
317
			return of;
317
			return of;
318
	}
318
	}
319
 
319
 
320
	return NULL;
320
	return NULL;
321
}
321
}
Line 337... Line 337...
337
	{
337
	{
338
		C_File *file = node->Data();
338
		C_File *file = node->Data();
339
		if ( file->GetFileType() != filetype )
339
		if ( file->GetFileType() != filetype )
340
			continue;
340
			continue;
341
 
341
 
342
		if ( file->GetFilename().Compare(CyString(filename)) )
342
		if ( file->filename().Compare(filename) )
343
			return;
343
			return;
344
	}
344
	}
345
 
345
 
346
	// check that no packages are currently using them either, not original if being used already
346
	// check that no packages are currently using them either, not original if being used already
347
	for ( CListNode<C_File> *node = pFiles->Front(); node; node = node->next() )
347
	for ( CListNode<C_File> *node = pFiles->Front(); node; node = node->next() )
348
	{
348
	{
349
		C_File *file = node->Data();
349
		C_File *file = node->Data();
350
		if ( file->GetFileType() != filetype )
350
		if ( file->GetFileType() != filetype )
351
			continue;
351
			continue;
352
 
352
 
353
		if ( file->GetFilename().Compare(CyString(filename)) )
353
		if ( file->filename().Compare(filename) )
354
			return;
354
			return;
355
	}
355
	}
356
 
356
 
357
	// add the file entry to the list
357
	// add the file entry to the list
358
	C_File *of = new C_File(filename);
358
	C_File *of = new C_File(filename);