summaryrefslogtreecommitdiffstats
path: root/src/script/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/script.cpp')
-rw-r--r--src/script/script.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp
index face9b7..001443b 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -3647,20 +3647,18 @@ bool CScript::ReadScript(const char* filename)
{
FILE* file;
Ui::CEdit* edit;
+ std::string name;
- // TODO: local user dir
- std::string name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename);
-
- /*if ( strchr(filename, '\\') == 0 )
+ if ( strchr(filename, '/') == 0 ) //we're reading non user script
{
- strcpy(name, "script\\");
- strcat(name, filename);
+ name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename);
}
else
{
-//? strcpy(name, filename);
- UserDir(name, filename, "");
- }*/
+ name = filename;
+ //TODO: is this needed?
+ // UserDir(name, filename, "");
+ }
file = fopen(name.c_str(), "rb");
if ( file == NULL ) return false;
@@ -3683,22 +3681,20 @@ bool CScript::ReadScript(const char* filename)
bool CScript::WriteScript(const char* filename)
{
Ui::CEdit* edit;
+ std::string name;
- std::string name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename);
- // TODO: local user dir
- /*if ( strchr(filename, '\\') == 0 )
+ if ( strchr(filename, '/') == 0 ) //we're writing non user script
{
- strcpy(name, "script\\");
- strcat(name, filename);
+ name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename);
}
else
{
- strcpy(name, filename);
- }*/
+ name = filename;
+ }
if ( m_script == 0 )
{
- // TODO: ? remove(filename);
+ remove(filename);
return false;
}