Skip to content

Commit 090478d

Browse files
author
Clement Champetier
committed
Item: add getTypeFromPath from a given string
* Can be used in bindings. * Hide getTypeFromPath from a given bfs::path, from bindings.
1 parent 72f628b commit 090478d

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

src/Item.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,25 @@ std::vector<Item> Item::explode()
4242
EType getTypeFromPath( const boost::filesystem::path& path )
4343
{
4444
if( bfs::is_symlink( path ) )
45-
{
46-
return eTypeLink;
47-
}
48-
if( bfs::is_regular_file( path ) )
4945
{
50-
return eTypeFile;
51-
}
46+
return eTypeLink;
47+
}
48+
if( bfs::is_regular_file( path ) )
49+
{
50+
return eTypeFile;
51+
}
5252
if( bfs::is_directory( path ) )
53-
{
54-
return eTypeFolder;
55-
}
56-
return eTypeUndefined;
53+
{
54+
return eTypeFolder;
55+
}
56+
return eTypeUndefined;
57+
}
58+
59+
60+
EType getTypeFromPath( const std::string& pathStr )
61+
{
62+
const boost::filesystem::path path( pathStr );
63+
return getTypeFromPath(path);
5764
}
5865

5966

src/Item.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ class Item
100100
};
101101

102102

103+
#ifndef SWIG
103104
EType getTypeFromPath( const boost::filesystem::path& path );
105+
#endif
106+
EType getTypeFromPath( const std::string& pathStr );
104107

105108

106109
std::ostream& operator<<( std::ostream& os, const Item& item );

0 commit comments

Comments
 (0)