/// <summary> /// Create from the path of a remote file, and the local filename to use. /// </summary> /// <param name="remoteRelativePath">Example: adir/a<file</param> /// <param name="localFilename">Example: afile.txt</param> public RemotePathSyncItem(string remoteRelativePath, string localFilename, RepoInfo repoInfo, Database.Database database) { this.isFolder = false; this.database = database; this.localRoot = repoInfo.TargetDirectory; this.remoteRoot = repoInfo.RemotePath; this.remoteRelativePath = remoteRelativePath; if (remoteRelativePath.StartsWith(this.remoteRoot)) { this.remoteRelativePath = this.remoteRelativePath.Substring(localRoot.Length).TrimStart(CmisUtils.CMIS_FILE_SEPARATOR); } int lastSeparator = remoteRelativePath.LastIndexOf(CmisUtils.CMIS_FILE_SEPARATOR); string remoteRelativeFolder = lastSeparator >= 0 ? remoteRelativePath.Substring(0, lastSeparator) : String.Empty; string remoteRelativePathWithCorrectLeafname = CmisUtils.PathCombine(remoteRelativeFolder, localFilename); localRelativePath = database.RemoteToLocal(remoteRelativePathWithCorrectLeafname, isFolder); }