org.eclipse.jgit.util

## Class FS_Win32_Cygwin

- java.lang.Object
- - org.eclipse.jgit.util.FS
  - - org.eclipse.jgit.util.FS_Win32
    - - org.eclipse.jgit.util.FS_Win32_Cygwin

    public class FS_Win32_Cygwin
    extends FS_Win32

FS implementation for Cygwin on Windows

Since:
  3.0

### Nested Class Summary

### Nested classes/interfaces inherited from class org.eclipse.jgit.util.FS

`FS.Attributes, FS.FSFactory`

### Field Summary

### Fields inherited from class org.eclipse.jgit.util.FS

`DETECTED`

### Constructor Summary

Constructors
`` `FS_Win32_Cygwin()` Constructor
`protected` `FS_Win32_Cygwin(FS src)` Constructor

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static boolean` `isCygwin()`
`FS` `newInstance()`
`String` `relativize(String base, String other)` See `FileUtils.relativize(String, String)`.
`File` `resolve(File dir, String pn)` Resolve this file to its actual path name that the JRE can use.
`ProcessResult` `runIfPresent(Repository repository, Hook hook, String[] args, PrintStream outRedirect, PrintStream errRedirect, String stdinArgs)` Checks whether the given hook is defined for the given repository, then runs it with the given arguments.
`ProcessBuilder` `runInShell(String cmd, String[] args)` Initialize a ProcesssBuilder to run a command using the system shell.
`protected File` `userHomeImpl()` Determine the user's home directory (location where preferences are).

### Methods inherited from class org.eclipse.jgit.util.FS_Win32

`canExecute, discoverGitPrefix, isCaseSensitive, retryFailedLockFileCommit, setExecute, supportsExecute`

### Methods inherited from class org.eclipse.jgit.util.FS

`createSymLink, delete, detect, detect, exists, findHook, getAttributes, gitPrefix, internalRunIfPresent, isDirectory, isFile, isHidden, isSymLink, lastModified, length, normalize, normalize, readPipe, readSymLink, runIfPresent, runProcess, searchPath, setGitPrefix, setHidden, setLastModified, setUserHome, supportsSymlinks, userHome`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FS_Win32_Cygwin

    public FS_Win32_Cygwin()

Constructor

#### FS_Win32_Cygwin

    protected FS_Win32_Cygwin(FS src)

Constructor

Parameters:
  `src` - instance whose attributes to copy

### Method Detail

#### isCygwin

    public static boolean isCygwin()

Returns:
  true if cygwin is found

#### newInstance

    public FS newInstance()

Overrides:
  `newInstance` in class `FS_Win32`
Returns:
  a new instance of the same type of FS.

#### resolve

    public File resolve(File dir,
                        String pn)

Description copied from class: `FS`
Resolve this file to its actual path name that the JRE can use.

This method can be relatively expensive. Computing a translation may require forking an external process per path name translated. Callers should try to minimize the number of translations necessary by caching the results.

Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 require translation for Cygwin based paths.

Overrides:
  `resolve` in class `FS`
Parameters:
  `dir` - directory relative to which the path name is.
  `pn` - path name to translate.
Returns:
  the translated path. `new File(dir,name)` if this platform does not require path name translation.

#### userHomeImpl

    protected File userHomeImpl()

Description copied from class: `FS`
Determine the user's home directory (location where preferences are).

Overrides:
  `userHomeImpl` in class `FS_Win32`
Returns:
  the user's home directory; null if the user does not have one.

#### runInShell

    public ProcessBuilder runInShell(String cmd,
                                     String[] args)

Description copied from class: `FS`
Initialize a ProcesssBuilder to run a command using the system shell.

Overrides:
  `runInShell` in class `FS_Win32`
Parameters:
  `cmd` - command to execute. This string should originate from the end-user, and thus is platform specific.
  `args` - arguments to pass to command. These should be protected from shell evaluation.
Returns:
  a partially completed process builder. Caller should finish populating directory, environment, and then start the process.

#### relativize

    public String relativize(String base,
                             String other)

Description copied from class: `FS`
See `FileUtils.relativize(String, String)`.

Overrides:
  `relativize` in class `FS`
Parameters:
  `base` - The path against which `other` should be relativized.
  `other` - The path that will be made relative to `base`.
Returns:
  A relative path that, when resolved against `base`, will yield the original `other`.
Since:
  3.7
See Also:
  `FileUtils.relativize(String, String)`

#### runIfPresent

    public ProcessResult runIfPresent(Repository repository,
                                      Hook hook,
                                      String[] args,
                                      PrintStream outRedirect,
                                      PrintStream errRedirect,
                                      String stdinArgs)
                               throws JGitInternalException

Description copied from class: `FS`
Checks whether the given hook is defined for the given repository, then runs it with the given arguments.

Overrides:
  `runIfPresent` in class `FS`
Parameters:
  `repository` - The repository for which a hook should be run.
  `hook` - The hook to be executed.
  `args` - Arguments to pass to this hook. Cannot be `null`, but can be an empty array.
  `outRedirect` - A print stream on which to redirect the hook's stdout. Can be `null`, in which case the hook's standard output will be lost.
  `errRedirect` - A print stream on which to redirect the hook's stderr. Can be `null`, in which case the hook's standard error will be lost.
  `stdinArgs` - A string to pass on to the standard input of the hook. May be `null`.
Returns:
  The ProcessResult describing this hook's execution.
Throws:
  `JGitInternalException` - if we fail to run the hook somehow. Causes may include an interrupted process or I/O errors.
Since:
  3.7