Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 2

The drive-letter-to function faster than running the cygpath program

If you need to pass a filename to a Windows program, such as the Visual C++ com-piler, you can usually just pass the relative path to the file using POSIX-style forward slashes. The Win32 API does not distinguish between forward and backward slashes. Unfortunately, some utilities that perform their own command-line argument pars-ing treat all forward slashes as command options. One such utility is the DOS print command; another is the net command.

If absolute paths are used, the drive letter syntax is always a problem. Although Win-dows programs are usually happy with forward slashes, they are completely unable to fathom the /c syntax. The drive letter must always be tranformed back into c:. To accomplish this and the forward/backslash conversion, Cygwin provides the cygpath utility to translate between POSIX paths and Windows paths.

ifdef COMSPEC
cygpath-mixed = $(shell cygpath -m "$1")
cygpath-unix = $(shell cygpath -u "$1")
drive-letter-to-slash = /$(subst :,,$1)
else
cygpath-mixed = $1
cygpath-unix = $1
drive-letter-to-slash = $1
endif

Cygwin | 133

This is the Title of the Book, eMatter Edition
Copyright © 2005 O’Reilly & Associates, Inc. All rights reserved.

If your commitment to Cygwin is strong and you do not need to build using native Win-dows support tools, you can safely place the Cygwin /bin directory at the front of your Windows path. This will guarantee access to Cygwin tools over Windows versions.

If your makefile is working with Java tools, be aware that Cygwin includes the GNU jar program that is incompatible with the standard Sun jar file format. Therefore, the Java jdk bin directory should be placed before the Cygwin /bin directory in your Path variable to avoid using Cygwin’s jar program.

ifdef COMSPEC
MV ?= move
RM ?= del
else
MV ?= mv -f
RM ?= rm -f
endif

If a simple block is used, the values can be changed by resetting them on the com-mand line, by editing the makefile, or (in this case because we used conditional assignment, ?=) by setting an environment variable. As mentioned previously, one

|
How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELI9104076
img
Uploaded by :
jmjOWdpx
Page 1 Preview
the driveletterto function faster than running the
Sell Your Old Documents & Earn Wallet Balance