Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

cygwin path with space as source path does not work #75

Closed
MoritzLoewenstein opened this issue May 31, 2023 · 1 comment
Closed

cygwin path with space as source path does not work #75

MoritzLoewenstein opened this issue May 31, 2023 · 1 comment

Comments

@MoritzLoewenstein
Copy link

When using a cygwin path with a space in it as a source, rsync will error out with error code 23.
I tried the following things:

  • escape space with backslash
  • modify rsync.js and put the source arguments in quotes (i tried single and double quotes)

I will try to resolve this issue but I am currently out of ideas.

@MoritzLoewenstein
Copy link
Author

Fixed it, replacing the space with a questionmark works. This is my function:

function windowsPathToCygwinPath(dirPath) {
	// get diskSign and rest of dirPath
	const diskSign = dirPath[0].toLowerCase();
	dirPath = dirPath.substr(2);

	// replace backslashes with forward slashes
	dirPath = dirPath.split(path.sep).join(path.posix.sep);

	// prepend 'cygdrive'
	dirPath = `/cygdrive/${diskSign}${dirPath}`;

	// replace space with questionmark to escape it
	dirPath = dirPath.replace(/ /g, '?');

	return dirPath;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant