diff options
Diffstat (limited to '')
| -rw-r--r-- | src/functionopen.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/functionopen.cpp b/src/functionopen.cpp index 4026a8c..075f43c 100644 --- a/src/functionopen.cpp +++ b/src/functionopen.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <bu/plugger.h> | 4 | #include <bu/plugger.h> |
| 5 | PluginInterface3( pluginFunctionOpen, open, FunctionOpen, Function, | 5 | PluginInterface3( pluginFunctionOpen, open, FunctionOpen, Function, |
| 6 | "Mike Buland", 0, 1 ); | 6 | "Mike Buland", 0, 1 ); |
| 7 | 7 | ||
| 8 | FunctionOpen::FunctionOpen() | 8 | FunctionOpen::FunctionOpen() |
| 9 | { | 9 | { |
| @@ -15,28 +15,28 @@ FunctionOpen::~FunctionOpen() | |||
| 15 | 15 | ||
| 16 | Bu::String FunctionOpen::getName() const | 16 | Bu::String FunctionOpen::getName() const |
| 17 | { | 17 | { |
| 18 | return "open"; | 18 | return "open"; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | Variable FunctionOpen::call( Variable &input, VarList lParams ) | 21 | Variable FunctionOpen::call( Variable &input, VarList lParams ) |
| 22 | { | 22 | { |
| 23 | if( lParams.getSize() != 2 ) | 23 | if( lParams.getSize() != 2 ) |
| 24 | { | 24 | { |
| 25 | throw Bu::ExceptionBase( | 25 | throw Bu::ExceptionBase( |
| 26 | "open takes two parameters, filename and mode." | 26 | "open takes two parameters, filename and mode." |
| 27 | ); | 27 | ); |
| 28 | } | 28 | } |
| 29 | Bu::String sMode = lParams.last().toString().toLower(); | 29 | Bu::String sMode = lParams.last().toString().toLower(); |
| 30 | int iMode = Bu::File::Create; | 30 | int iMode = Bu::File::Create; |
| 31 | if( sMode.find('w') ) | 31 | if( sMode.find('w') ) |
| 32 | iMode |= Bu::File::Write; | 32 | iMode |= Bu::File::Write; |
| 33 | if( sMode.find('r') ) | 33 | if( sMode.find('r') ) |
| 34 | iMode |= Bu::File::Read; | 34 | iMode |= Bu::File::Read; |
| 35 | Variable vRet( | 35 | Variable vRet( |
| 36 | (void *)FileMgr::getInstance().open( | 36 | (void *)FileMgr::getInstance().open( |
| 37 | lParams.first().toString(), iMode | 37 | lParams.first().toString(), iMode |
| 38 | ) | 38 | ) |
| 39 | ); | 39 | ); |
| 40 | return vRet; | 40 | return vRet; |
| 41 | } | 41 | } |
| 42 | 42 | ||
