Commit Graph

262 Commits

Author SHA1 Message Date
Brad King 0f5189d144 KWSys: Fix GetActualCaseForPath for UNC paths
See issue #11023.

Author: Clinton Stimpson <clinton@elemtech.com>
2010-08-16 10:00:02 -04:00
Brad King 0a21abd690 KWSys: Fix SplitPath for leading '\' on Windows
Windows paths may begin with a single backslash when the drive letter is
omitted.  Recognize this as a root path component.
2010-08-16 09:10:03 -04:00
Brad King ac17dc4a43 KWSys: Remove "copyPermissions" parameters
The CopyFileIfDifferent, CopyFileAlways, CopyAFile and CopyADirectory
methods should always copy permissions.  The special cases in which a
caller would pass copyPermissions=false should be handled at the call
site.  The parameter needlessly complicates the interface and semantics
of these methods.
2010-06-04 16:02:00 -04:00
Brad King c15ed3294c KWSys: Avoid stat in CopyFileAlways (#10790)
On Windows 7 the file size reported by 'stat' on a new file sometimes
reports zero even though the real size is correct.  This causes our
CopyFileAlways method to falsely detect copy failure.  Work around the
problem by trusting the state of ofstream after writing the file.
2010-06-03 12:46:11 -04:00
Bill Hoffman e2c496e2af Fix for bug #10542, allow this to build on Tru64 2010-05-04 14:43:43 -04:00
David Cole 018c13ff73 Patch to avoid short name usage where possible. Get the actual case spelling of a file name on 'Windows' without converting to short name and back again. Avoids bad behavior reported in http://bugs.winehq.org/show_bug.cgi?id=22286 when using cmake under a wine/msys/mingw installation on a Linux box. Thanks to Clinton Stimpson for preparing the patch. 2010-04-09 12:15:06 -04:00
Zach Mullen 254d267e36 Mac has gettimeofday defined, but cmsys wasn't aware of that, so it was falling back to using time() which only provides second resolution. Fixed to allow usec res. 2009-11-24 14:10:05 -05:00
David Cole 847918b38f Better fix for crash on Windows. This time it will even work on Linux, too. That GetLineFromStream method while loop sure is fussy. 2009-10-16 13:23:52 -04:00
David Cole 9578bfc0ef Fix crash on Windows. If input stream is no good, do not try to read a line from it. Return false and an empty line instead... 2009-10-16 11:43:05 -04:00
Brad King de955e4b6d Convert KWSys to OSI-approved BSD License
This converts the KWSys license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the KWSys copyright to
cover the full development time range.
2009-09-28 11:37:35 -04:00
Brad King f10929ae7c Restore KWSys SystemTools _WIN32 state on cygwin
The commit "Fix KWSys SystemTools build on cygwin with -mwin32" tried to
restore the state of the _WIN32 definition that was broken by the commit
"Optimize KWSys SystemTools::FileExists on Windows".  It did so for the
case of building with -mwin32 on cygwin, but since including <windows.h>
defines _WIN32, it failed for the case of not using -mwin32.

This commit restores the state of _WIN32 in all cases by undefining it
after including <windows.h> if it was not defined beforehand.
2009-09-24 08:10:46 -04:00
Brad King 4e121af95e Fix KWSys SystemTools build on cygwin with -mwin32
Commit "Optimize KWSys SystemTools::FileExists on Windows" accidentally
added "#undef _WIN32" when including <windows.h> on cygwin, which breaks
builds using the -mwin32 flag.  This commit removes that line and fixes
the real error it was intended to avoid.
2009-09-23 10:45:00 -04:00
Bill Hoffman e7601ca600 Put a flag in that will stop system tools from deleting system environment memory on exit, as it can cause gcov to crash the programs. 2009-09-22 14:56:33 -04:00
Brad King 9b6c3d0782 Optimize KWSys SystemTools::FileExists on Windows
We optimize this method by using the GetFileAttributesExA native Windows
API to check for file existence when possible.  For real Windows builds
we always use it.  For Cygwin we use cygwin_conv_to_win32_path to get a
native Windows path if possible and otherwise fall back to 'access'.

Cygwin-to-Windows path conversion and cache by Wojciech Migda.
See issue #8826.
2009-09-22 13:02:20 -04:00
Dave Partyka 9e7a3d7ece COMP: attempt to fix more 'hidden by' warnings. 2009-08-06 19:01:13 -04:00
Dave Partyka 1d158cffca ENH: try and see if using string.append instead of += will make valgrind not complaing that JoinPath is leaking. 2009-07-26 01:01:05 -04:00
Brad King d445275ed0 COMP: Remove useless variable assignment
This removes an assignment whose result is never used, thus quieting a
warning from Borland.
2009-06-22 14:19:17 -04:00
Bill Hoffman 8446a48054 ENH: use .exe on vms 2009-06-11 15:25:48 -04:00
Brad King fc537f05ba ENH: Teach KWSys SystemTools about VMS paths
This teaches ConvertToUnixSlashes to convert VMS paths into posix-style
paths.  We also set the DECC$FILENAME_UNIX_ONLY feature so the process
always sees posix-style paths on disk.
2009-06-10 13:02:48 -04:00
Bill Hoffman 0de79d4b2d ENH: fix warning on borland 2009-06-05 13:17:01 -04:00
Bill Hoffman fdff8eb300 ENH: move PutEnv to SystemTools 2009-06-05 12:01:30 -04:00
Brad King cecfce23a5 BUG: Fix removal of read-only directories
Read-only directories must be given write permission before we can
remove files and subdirectories from them.
2009-05-13 10:30:33 -04:00
Bill Hoffman 7fc99c94d4 ENH: check in almost building VMS stuff with VMSBuild directory since the bootstrap script will not work on VMS 2009-04-23 11:09:47 -04:00
Brad King 714d2fc04b ENH: Remove obscure method from KWSys SystemTools
This removes SystemTools::FileExistsInParentDirectories from KWSys since
it is a special-purpose method that is not generally useful.
2009-04-21 11:36:59 -04:00
Brad King 20f4fdee33 BUG: Fix SystemTools::IsSubDirectory on bad input
When SystemTools::GetParentDirectory was fixed to never remove the root
path component from a full path we violated an assumption made by
IsSubDirectory that eventually GetParentDirectory returns an empty
string.  This led to an infinite loop if the potential parent directory
is empty, so we explicitly avoid that case.
2009-04-20 08:42:05 -04:00
Brad King 3824f54c17 BUG: Replace brittle GetParentDirectory impl
The previous change to this method broke cases where the input path does
not exist.  The SystemTools::GetParentDirectory method is redundant with
the more robust SystemTools::GetFilenamePath.  This replaces its
implementation to just call GetFilenamePath.
2009-04-15 13:03:33 -04:00
Yumin Yuan f3035ff78d BUG: SystemTools::GetParentDirectory() will crash if "/" is passed in as argement. Valid check is added to make sure the input argment exists, and if "/" is passed in, empty string will be returned. 2009-04-15 10:45:29 -04:00
Francois Bertel 431c456cf5 COMP:Fixed warnings. 2009-03-18 08:50:55 -04:00
Brad King 6ed916795d BUG: Work around broken GetLongPathName case
On Windows the GetLongPathName API function does not work on some
filesystems even if the file exists.  In this case we should just use
the original long path name and not the GetShortPathName result.
See issue #8480.
2009-02-09 16:45:15 -05:00
Brad King ca096a4596 BUG: Fix GetRealPath when realpath fails
This patch from Philip Lowman teaches SystemTools::GetRealPath to deal
with paths that do not exist by dealing with the case that realpath
returns NULL.  See issue #8423.
2009-02-09 09:23:13 -05:00
David Cole 0fafdb7eb8 BUG: Do not copy permissions of files when making the copy in an install rule. If the source file was read-only, this prevents the subsequent set of the destination file's modification time, making the copied file always different in time-stamp than the original and always installing a new file with a new time stamp (but the same content) causing unnecessary downstream incremental rebuilds. As part of this fix, add an optional copyPermissions parameter to the SystemTools routines CopyFileIfDifferent, CopyFileAlways, CopyAFile and CopyADirectory. The copyPermissions parameter defaults to true to preserve the behavior of these routines for existing callers. 2008-12-18 10:43:24 -05:00
Sebastien Barre 8e5886e652 ENH: fix for Vista 2008-10-16 19:30:49 -04:00
Sebastien Barre b55f7a261f ENH: oops 2008-10-16 11:34:16 -04:00
Sebastien Barre ef93279573 ENH: fix for Windows Vista 2008-10-15 23:24:33 -04:00
Brad King b3f43f0065 STYLE: Fix typo in GetFilenameLastExtension docs
See issue #7797.
2008-10-10 11:23:02 -04:00
Bill Hoffman 64fc597de2 ENH: add initial support for HAIKU OS from bug# 7425 2008-09-15 17:53:28 -04:00
Brad King cea66664c5 ENH: Added WOW64 key view support to KWSys SystemTools' windows registry API.
- Add an argument to registry read/write/delete methods to specify
    a 32-bit or 64-bit view.
  - Default is the bit-ness of the running program.
  - See issue #7095.
2008-05-27 14:47:00 -04:00
Bill Lorensen 68dfcefbcb COMP: sprintf warnings. DWORD should use %ld rather than %d. Also, const char *p, a shadowed variable warning. 2008-05-10 22:48:53 -04:00
Jeffrey Baumes 4cf167173f ENH: Allow numbers in username in URL regex. 2008-04-23 12:51:02 -04:00
Bill Hoffman 7dcfdf5005 BUG: fix install problem on make and allow symlinks to cmake bin directory 2008-03-27 17:05:11 -04:00
Brad King 9198a92af9 COMP: Fix VS6 and old HP build. This source does not have the #define for hack. 2008-01-21 08:01:04 -05:00
Brad King ce2b20361a BUG: Fix previous commit to not access empty strings out of bounds. 2008-01-20 19:29:12 -05:00
Brad King c7b844ba3e BUG: Make sure search paths never have double-slashes. Leading with two slashes (//) on cygwin looks like a network path and delays while waiting for a non-existent machine. 2008-01-20 17:24:46 -05:00
Brad King 615ce67ad4 COMP: Fix build on borland. 2008-01-12 09:52:50 -05:00
Brad King a6d32b96ed ENH: Add SystemTools::SplitPathRootComponent and re-implement SplitPath to use it. Add better treatment of user home directory paths. 2008-01-11 08:33:48 -05:00
Bill Hoffman a5e76555bf BUG: fix for bug 6136 make sure includes are not directories 2007-12-14 20:31:27 -05:00
Philippe Pebay 836e595fcc BUG: fixed an incomplete regexp 2007-12-06 16:43:11 -05:00
Brad King cc80c4e285 COMP: Remove reference to vtksys. The unmangled kwsys name should be used in this source. 2007-12-05 13:13:53 -05:00
Philippe Pebay f18ae2234c ENH: added two functions for URL parsing:
1. an "abridged" version that separates protocol from dataglom in
        an expression with the form protocol://dataglom
     2. a "full" version that parses protocol, username, password,
        hostname, port, and path in a standard URL (all of these variables
        are optional, except for protocol and hostname).
2007-12-05 12:24:27 -05:00
Bill Hoffman 39c164cb83 ENH: remove warning 2007-12-04 17:00:44 -05:00