Commit 33eece03 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fixed ServerFileListing proxy.

Removed obsolete and not much used vtkPVServerFileListing class. Instead added
API to vtkPVFileInformationHelper itself to get file status for the active path.
This is now used in the (file_listing, ServerFileListing) proxy. For anything
more detailed, one should use the vtkPVFileInformationHelper and
vtkPVFileInformation pair.
parent 7e41a51f
......@@ -16,6 +16,8 @@
#include "vtkObjectFactory.h"
#include <vtksys/SystemTools.hxx>
vtkStandardNewMacro(vtkPVFileInformationHelper);
//-----------------------------------------------------------------------------
vtkPVFileInformationHelper::vtkPVFileInformationHelper()
......@@ -42,6 +44,18 @@ vtkPVFileInformationHelper::~vtkPVFileInformationHelper()
this->SetWorkingDirectory(0);
}
//-----------------------------------------------------------------------------
bool vtkPVFileInformationHelper::GetActiveFileIsReadable()
{
return vtksys::SystemTools::FileExists(this->Path);
}
//-----------------------------------------------------------------------------
bool vtkPVFileInformationHelper::GetActiveFileIsDirectory()
{
return vtksys::SystemTools::FileIsDirectory(this->Path);
}
//-----------------------------------------------------------------------------
void vtkPVFileInformationHelper::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -82,6 +82,15 @@ public:
// Description:
// Returns the platform specific path separator.
vtkGetStringMacro(PathSeparator);
// Description:
// Returns if this->Path is a readable file.
bool GetActiveFileIsReadable();
// Description:
// Returns if this->Path is a directory.
bool GetActiveFileIsDirectory();
protected:
vtkPVFileInformationHelper();
~vtkPVFileInformationHelper();
......
......@@ -186,7 +186,6 @@ SET(Filters_SRCS
vtkPVRepresentedDataInformation.cxx
vtkPVScalarBarActor.cxx
vtkPVSelectionSource.cxx
vtkPVServerFileListing.cxx
vtkPVServerObject.cxx
vtkPVServerSelectTimeSet.cxx
vtkPVSinusoidKeyFrame.cxx
......
This diff is collapsed.
/*=========================================================================
Program: ParaView
Module: vtkPVServerFileListing.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPVServerFileListing - Server-side helper for vtkPVFileListing.
// .SECTION Description
#ifndef __vtkPVServerFileListing_h
#define __vtkPVServerFileListing_h
#include "vtkPVServerObject.h"
class vtkClientServerStream;
class vtkPVServerFileListingInternals;
class VTK_EXPORT vtkPVServerFileListing : public vtkPVServerObject
{
public:
static vtkPVServerFileListing* New();
vtkTypeMacro(vtkPVServerFileListing, vtkPVServerObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get a list of files in the given directory on the server.
const vtkClientServerStream& GetFileListing(const char* dirname,
int save);
// Description:
// Returns a list of "special" files / directories on the server (includes Win32 drives, Win32 favorites, home directory, etc)
const vtkClientServerStream& GetSpecial();
// Description:
// Get the current working directory of the process on the server.
const char* GetCurrentWorkingDirectory();
// Description:
// Check if the given directory exists on the server.
int FileIsDirectory(const char* dirname);
// Description:
// Check if the given file is readable on the server.
int FileIsReadable(const char* name);
protected:
vtkPVServerFileListing();
~vtkPVServerFileListing();
// Internal implementation details.
vtkPVServerFileListingInternals* Internal;
void List(const char* dirname, int save);
private:
vtkPVServerFileListing(const vtkPVServerFileListing&); // Not implemented
void operator=(const vtkPVServerFileListing&); // Not implemented
};
#endif
......@@ -1455,42 +1455,32 @@
</ProxyGroup>
<ProxyGroup name="file_listing">
<ServerFileListingProxy name="ServerFileListing"
class="vtkPVServerFileListing">
<Proxy name="ServerFileListing"
class="vtkPVFileInformationHelper">
<IntVectorProperty
name="ActiveFileIsDirectory"
command="GetActiveFileIsDirectory"
number_of_elements="1"
information_only="1"
update_self="1"
default_values="0">
information_only="1">
<SimpleIntInformationHelper />
</IntVectorProperty>
<IntVectorProperty
name="ActiveFileIsReadable"
command="GetActiveFileIsReadable"
number_of_elements="1"
information_only="1"
update_self="1"
default_values="0">
information_only="1">
<SimpleIntInformationHelper />
</IntVectorProperty>
<StringVectorProperty
name="ActiveFileName"
command="SetActiveFileName"
number_of_elements="1"
update_self="1">
</StringVectorProperty>
<StringVectorProperty
name="CurrentWorkingDirectory"
command="GetCurrentWorkingDirectory"
number_of_elements="1"
information_only="1">
<SimpleStringInformationHelper />
command="SetPath"
number_of_elements="1">
<Documentation>
Set the filename whose information we need.
</Documentation>
</StringVectorProperty>
</ServerFileListingProxy>
</Proxy>
</ProxyGroup>
<ProxyGroup name="locators">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment