mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-05 00:23:56 +01:00
Changes from Richard to remove the remains of UploadDialog, which was deemed to be a hazard. + a change for Win.
This commit is contained in:
@@ -19,69 +19,12 @@
|
||||
FileIO::FileIO(const wxString name, FileIOMode mode)
|
||||
: mName(name),
|
||||
mMode(mode),
|
||||
mFtp(NULL),
|
||||
mInputStream(NULL),
|
||||
mOutputStream(NULL),
|
||||
mOpen(false)
|
||||
{
|
||||
wxString scheme;
|
||||
|
||||
mUri.Create(mName);
|
||||
scheme = mUri.GetScheme();
|
||||
|
||||
if (scheme == wxT("ftp")) {
|
||||
wxString user = mUri.GetUser();
|
||||
wxString pass = mUri.GetPassword();;
|
||||
|
||||
mFtp = new wxFTP();
|
||||
mFtp->SetDefaultTimeout(60);
|
||||
|
||||
if (!user.IsEmpty()) {
|
||||
mFtp->SetUser(user);
|
||||
}
|
||||
|
||||
if (!pass.IsEmpty()) {
|
||||
mFtp->SetPassword(pass);
|
||||
}
|
||||
|
||||
if (!mFtp->Connect(mUri.GetServer())) {
|
||||
wxPrintf(wxT("Couldn't connect to server\n"));
|
||||
|
||||
delete mFtp;
|
||||
mFtp = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mFtp->SetBinary();
|
||||
mFtp->SetPassive(true);
|
||||
|
||||
if (mMode == FileIO::Input) {
|
||||
mInputStream = mFtp->GetInputStream(mUri.GetPath());
|
||||
if (mInputStream == NULL) {
|
||||
wxPrintf(wxT("Couldn't get input stream: %s\n"), mUri.GetPath().c_str());
|
||||
|
||||
delete mFtp;
|
||||
mFtp = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mOutputStream = mFtp->GetOutputStream(mUri.GetPath());
|
||||
if (mOutputStream == NULL) {
|
||||
wxPrintf(wxT("Couldn't get output stream: %s\n"), mUri.GetPath().c_str());
|
||||
|
||||
delete mFtp;
|
||||
mFtp = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mOpen = true;
|
||||
}
|
||||
else {
|
||||
if (mMode == FileIO::Input) {
|
||||
mInputStream = new wxFFileInputStream(mName);
|
||||
if (mInputStream == NULL) {
|
||||
@@ -98,7 +41,6 @@ FileIO::FileIO(const wxString name, FileIOMode mode)
|
||||
}
|
||||
|
||||
mOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
FileIO::~FileIO()
|
||||
@@ -123,11 +65,6 @@ void FileIO::Close()
|
||||
mInputStream = NULL;
|
||||
}
|
||||
|
||||
if (mFtp) {
|
||||
delete mFtp;
|
||||
mFtp = NULL;
|
||||
}
|
||||
|
||||
SetCatalogInfo();
|
||||
|
||||
mOpen = false;
|
||||
@@ -139,7 +76,7 @@ void FileIO::Close()
|
||||
void FileIO::SetCatalogInfo()
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
if (!mOpen || mFtp != NULL) {
|
||||
if (!mOpen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -161,7 +98,7 @@ void FileIO::SetCatalogInfo()
|
||||
void FileIO::SetCatalogInfo(wxUint32 type)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
if (!mOpen || mFtp != NULL) {
|
||||
if (!mOpen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user