예제 #1
0
def Replace(oldPath, newPath, fileContent):
	
	relList = getRel.getRel (fileContent)
	
	newRelatives = [absRel3.RelToRel(oldPath, newPath, relative) for relative in relList]

	fileContent = replacePath.go(relList, newRelatives, fileContent)
	return fileContent
예제 #2
0
def go(filePath):
	"""Returns file content with repaired relative paths"""
	fileContent = filer.read(filePath)
	relPathList = getRel.getRel (fileContent)

	fileNames = [relPath.split("/")[-1] for relPath in relPathList]
	color.blue("fileNames")
	print(fileNames)

	futherFolder = getFutherFolder_model.get(filePath)
	absFileNames = [recursiveSearch_model.find_files(futherFolder, fileName) for fileName in fileNames]

	color.blue("absFileNames")
	print(absFileNames)

	newRelPathList = [absRel.Rel(filePath, absPath) for absPath in absFileNames]
	
	# first found would be inserted

	fileContent = replacePath.go(relPathList, newRelPathList, fileContent)
	return fileContent