[Saga-devel] saga SVN commit 3318: /trunk/adaptors/default/file/
amerzky at cct.lsu.edu
amerzky at cct.lsu.edu
Sat Jan 17 06:15:29 CST 2009
User: amerzky
Date: 2009/01/17 06:15 AM
Modified:
/trunk/adaptors/default/file/
common_helpers.hpp, default_dir.cpp, default_file.cpp
Log:
more consistent use of localhost checks
A
File Changes:
Directory: /trunk/adaptors/default/file/
========================================
File [modified]: common_helpers.hpp
Delta lines: +2 -3
===================================================================
--- trunk/adaptors/default/file/common_helpers.hpp 2009-01-17 12:09:26 UTC (rev 3317)
+++ trunk/adaptors/default/file/common_helpers.hpp 2009-01-17 12:15:17 UTC (rev 3318)
@@ -97,9 +97,8 @@
inline bool
file_islocal(saga::url const& file_url)
{
- // we consider a file to be local if it's located on the local host
- std::string host(file_url.get_host());
- if (!host.empty() && host != "localhost" && !boost::iequals(host, get_hostname()))
+ // we consider a file to be local if it's located on the local host
+ if ( ! saga::adaptors::utils::url_is_local (file_url) )
return false; // remote files are not local
// we consider a file to be local if it has no scheme at all or if the scheme
File [modified]: default_dir.cpp
Delta lines: +1 -10
===================================================================
--- trunk/adaptors/default/file/default_dir.cpp 2009-01-17 12:09:26 UTC (rev 3317)
+++ trunk/adaptors/default/file/default_dir.cpp 2009-01-17 12:15:17 UTC (rev 3318)
@@ -45,22 +45,13 @@
fs::path path (saga::url::unescape(dir_url.get_path()), fs::native);
- std::string host(dir_url.get_host());
- if ( ! saga::adaptors::utils::url_is_local (dir_url) )
+ if ( ::detail::file_islocal (dir_url) )
{
SAGA_OSSTREAM strm;
strm << "dir_cpi_impl::init: cannot handle file: " << dir_url.get_url();
SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::BadParameter);
}
- std::string scheme(dir_url.get_scheme());
- if (!scheme.empty() && scheme != "file" && scheme != "any")
- {
- SAGA_OSSTREAM strm;
- strm << "dir_cpi_impl::init: cannot handle file: " << dir_url.get_url();
- SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::BadParameter);
- }
-
// check if file exists AND is a dir (not a file)
bool exists = fs::exists(path);
bool is_dir = false;
File [modified]: default_file.cpp
Delta lines: +1 -9
===================================================================
--- trunk/adaptors/default/file/default_file.cpp 2009-01-17 12:09:26 UTC (rev 3317)
+++ trunk/adaptors/default/file/default_file.cpp 2009-01-17 12:15:17 UTC (rev 3318)
@@ -50,21 +50,13 @@
saga::url file_url(data->location_);
std::string url = saga::url::unescape(file_url.get_path());
- if ( ! saga::adaptors::utils::url_is_local (file_url) )
+ if ( ::detail::file_islocal (file_url) )
{
SAGA_OSSTREAM strm;
strm << "Cannot handle remote file: " << data->location_ ;
SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::IncorrectURL);
}
- std::string scheme(file_url.get_scheme());
- if (!scheme.empty() && scheme != "file" && scheme != "any")
- {
- SAGA_OSSTREAM strm;
- strm << "Cannot handle remote file: " << data->location_;
- SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), saga::IncorrectURL);
- }
-
saga::filesystem::flags mode = (saga::filesystem::flags)data->mode_;
namespace fs = boost::filesystem;
More information about the saga-devel
mailing list