Commit 4ad5b8df authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

linux build, changes some file separators

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59360 954022d7-b5bf-4e40-9824-e11837661b57
parent 6de7677b
......@@ -5,6 +5,7 @@
#include <stdio.h>
#include <time.h>
#include "../../../../../Common/DocxFormat/Source/Base/Base.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
......@@ -1357,12 +1358,12 @@ static BOOL WmfOpenTempFile(CString *pwsName, FILE **ppFile, wchar_t *wsMode, wc
std::wstring wsTempDir = UTF8_TO_U( wsTempDirA );
wsTemp = wsTempDir.c_str();
#endif
wsTemp.Append( L"\\" );
wsTemp.Append( _T("/") );
}
else if( wsFolder != NULL )
{
wsTemp = CString( wsFolder );
wsTemp.Append( L"\\" );
wsTemp.Append( _T("/") );
}
else
{
......
......@@ -28,7 +28,8 @@ namespace Writers
m_oWriter.WriteString(g_string_ct_End);
CFile oFile;
oFile.CreateFile(m_sDir + _T("\\[Content_Types].xml"));
oFile.CreateFile (m_sDir + _T("/[Content_Types].xml"));
oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile();
}
......@@ -43,4 +44,4 @@ namespace Writers
}
};
}
#endif // #ifndef CONTENT_TYPES_WRITER
\ No newline at end of file
#endif // #ifndef CONTENT_TYPES_WRITER
......@@ -25,7 +25,7 @@ namespace Writers
OOX::CSystemUtility::CreateDirectories(m_sMediaDir);
CString sNewImgName;sNewImgName.Format(_T("image%d.jpg"), (nImageCount + 1));
CString sNewImg = m_sMediaDir + _T("\\") + sNewImgName;
CString sNewImg = m_sMediaDir + _T("/") + sNewImgName;
nImageCount++;
return sNewImg;
}
......@@ -60,4 +60,4 @@ namespace Writers
}
};
}
#endif // #ifndef MEDIA_WRITER
\ No newline at end of file
#endif // #ifndef MEDIA_WRITER
......@@ -743,7 +743,7 @@ namespace NSBinPptxRW
oContentTypes.WriteString(_T("</Types>"));
CFile oFile;
oFile.CreateFile(m_strDstFolder + _T("\\[Content_Types].xml"));
oFile.CreateFile(m_strDstFolder + _T("/[Content_Types].xml"));
CString strContentTypes = oContentTypes.GetData();
oFile.WriteStringUTF8(strContentTypes);
oFile.CloseFile();
......
......@@ -52,6 +52,13 @@
#include <atlstr.h>
#include <atltypes.h>
// windows-stype separator for paths i.e. 'c:\home\documents\file.ext'
#ifndef FILE_SEPARATOR
#define FILE_SEPARATOR
#define FILE_SEPARATOR_CHAR '\\'
#define FILE_SEPARATOR_STR _T("\\")
#endif
typedef unsigned int size_t;
#include "../../../ASCUtils.h"
......@@ -62,6 +69,14 @@ using namespace ATL;
#include "ASCString.h"
#include "stdint.h"
// linux-stype separator for paths i.e. '/home/documents/file.ext'
#ifndef FILE_SEPARATOR
#define FILE_SEPARATOR
#define FILE_SEPARATOR_CHAR '/'
#define FILE_SEPARATOR_STR _T("/")
#endif
/*
typedef int BOOL;
static const BOOL TRUE = 1;
......
#include "Directory.h"
#include "../../Base/ASCString.h"
#include "../../Base/Base.h"
#include <unistd.h>
#include <sys/stat.h>
......@@ -182,7 +182,7 @@ namespace FileSystem {
}
CString Directory::GetFolderPath(const CString& strFolderPath)
{
int n1 = strFolderPath.rfind(_T("\\"));
int n1 = strFolderPath.rfind(FILE_SEPARATOR_STR);
if (n1 < 0 )
return _T("");
return strFolderPath.substr(0,n1);
......
......@@ -69,7 +69,7 @@ namespace OOX
}
AVSINLINE CString GetDirectory(bool bIsSlash = true) const
{
int nPos = m_strFilename.ReverseFind('\\');
int nPos = m_strFilename.ReverseFind(FILE_SEPARATOR_CHAR);
if (-1 == nPos)
{
return m_strFilename;
......@@ -87,7 +87,7 @@ namespace OOX
}
AVSINLINE CString GetFilename() const
{
int nPos = m_strFilename.ReverseFind('\\');
int nPos = m_strFilename.ReverseFind(FILE_SEPARATOR_CHAR);
if (-1 == nPos)
{
return m_strFilename;
......@@ -118,7 +118,7 @@ namespace OOX
while (nCurrent < nLen)
{
if (pData[nCurrent] == (TCHAR)'\\' || pData[nCurrent] == (TCHAR)'/')
if (pData[nCurrent] == (TCHAR) '\\' || pData[nCurrent] == (TCHAR)'/')
{
if (nStart < nCurrent)
{
......@@ -137,7 +137,7 @@ namespace OOX
}
if (!bIsUp)
{
pDataNorm[nCurrentW++] = (TCHAR)'\\';
pDataNorm[nCurrentW++] = (TCHAR) FILE_SEPARATOR_CHAR;
++nCurrentSlash;
pSlashPoints[nCurrentSlash] = nCurrentW;
}
......
......@@ -108,6 +108,9 @@ bool CxImage::EncodeSafeCheck(CxFile *hFile)
*/
bool CxImage::Save(const TCHAR * filename, uint32_t imagetype)
{
#ifdef CXIMAGE_DONT_USE_LOAD_SAVE
return false;
#else
FILE* hFile; //file handle to write the image
#ifdef WIN32
......@@ -124,6 +127,7 @@ bool CxImage::Save(const TCHAR * filename, uint32_t imagetype)
bool bOK = Encode(hFile,imagetype);
fclose(hFile);
return bOK;
#endif //#ifdef CXIMAGE_DONT_USE_LOAD_SAVE
}
////////////////////////////////////////////////////////////////////////////////
/**
......@@ -570,6 +574,9 @@ bool CxImage::Encode2RGBA(CxFile *hFile, bool bFlipY)
bool CxImage::Load(const TCHAR * filename, uint32_t imagetype)
//bool CxImage::Load(const char * filename, uint32_t imagetype)
{
#ifdef CXIMAGE_DONT_USE_LOAD_SAVE
return false;
#else
/*FILE* hFile; //file handle to read the image
if ((hFile=fopen(filename,"rb"))==NULL) return false;
bool bOK = Decode(hFile,imagetype);
......@@ -619,6 +626,7 @@ bool CxImage::Load(const TCHAR * filename, uint32_t imagetype)
if (!bOK && imagetype > 0) strcpy(info.szLastError,szError); //restore the first error
return bOK;
#endif // #ifdef CXIMAGE_DONT_USE_LOAD_SAVE
}
////////////////////////////////////////////////////////////////////////////////
#ifdef WIN32
......
......@@ -31,6 +31,9 @@ public:
//////////////////////////////////////////////////////////
bool Open(const TCHAR * filename, const TCHAR * mode)
{
#ifdef CXIMAGE_DONT_USE_LOAD_SAVE
return false;
#else
#ifdef WIN32
if (m_fp) return false; // Can't re-open without closing first
......@@ -41,6 +44,7 @@ public:
#endif
return true;
#endif // #ifdef CXIMAGE_DONT_USE_LOAD_SAVE
}
//////////////////////////////////////////////////////////
virtual bool Close()
......
......@@ -2,6 +2,7 @@
#include "../raster/BgraFrame.h"
#include <cstring> // memset
namespace Aggplus
{
////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -950,7 +950,7 @@ namespace BinXlsxRW{
{
CString sThemeOverrideName;sThemeOverrideName.Format(_T("themeOverride%d.xml"), m_oSaveParams.nThemeOverrideCount++);
CString sThemeOverrideRelsPath;sThemeOverrideRelsPath.Format(_T("../theme/%s"), sThemeOverrideName);
CString sThemeOverridePath;sThemeOverridePath.Format(_T("%s\\%s"), m_oSaveParams.sThemePath, sThemeOverrideName);
CString sThemeOverridePath;sThemeOverridePath.Format(_T("%s/%s"), m_oSaveParams.sThemePath, sThemeOverrideName);
long nCurPos = m_oBufferedStream.GetPos();
m_pOfficeDrawingConverter->SaveThemeXml(nCurPos, length, sThemeOverridePath);
......
......@@ -1839,11 +1839,11 @@ namespace BinXlsxRW {
else if(c_oSerWorksheetsTypes::Drawings == type)
{
CString sDrawingsDir;
sDrawingsDir.Format(_T("%s\\xl\\drawings"), m_sDestinationDir);
sDrawingsDir.Format(_T("%s/xl/drawings"), m_sDestinationDir);
if( !NSDirectory::Exists(string2std_string(sDrawingsDir)) )
OOX::CSystemUtility::CreateDirectories(sDrawingsDir);
CString sRelsDir;
sRelsDir.Format(_T("%s\\_rels"), sDrawingsDir);
sRelsDir.Format(_T("%s/_rels"), sDrawingsDir);
if( !NSDirectory::Exists(string2std_string(sRelsDir)) )
OOX::CSystemUtility::CreateDirectories(sRelsDir);
......@@ -1858,7 +1858,7 @@ namespace BinXlsxRW {
CString sFilename = m_pCurDrawing->m_sFilename;
CString sRelsPath;
sRelsPath.Format(_T("%s\\%s.rels"), sRelsDir, sFilename);
sRelsPath.Format(_T("%s/%s.rels"), sRelsDir, sFilename);
m_pOfficeDrawingConverter->SaveDstContentRels(sRelsPath);
}
else if(c_oSerWorksheetsTypes::SheetData == type)
......@@ -2421,11 +2421,11 @@ namespace BinXlsxRW {
{
// rels
CString sChartsDir;
sChartsDir.Format(_T("%s\\xl\\charts"), m_sDestinationDir);
sChartsDir.Format(_T("%s/xl/charts"), m_sDestinationDir);
if( !NSDirectory::Exists(string2std_string(sChartsDir)) )
OOX::CSystemUtility::CreateDirectories(sChartsDir);
CString sRelsDir;
sRelsDir.Format(_T("%s\\_rels"), sChartsDir);
sRelsDir.Format(_T("%s/_rels"), sChartsDir);
if( !NSDirectory::Exists(string2std_string(sRelsDir)) )
OOX::CSystemUtility::CreateDirectories(sRelsDir);
m_pOfficeDrawingConverter->SetDstContentRels();
......@@ -2437,7 +2437,7 @@ namespace BinXlsxRW {
pChartFile->m_bDoNotAddRels = true;
m_pCurDrawing->Add(pChartFile);
CString sRelsPath;sRelsPath.Format(_T("%s\\%s.rels"), sRelsDir, pChartFile->m_sFilename);
CString sRelsPath;sRelsPath.Format(_T("%s/%s.rels"), sRelsDir, pChartFile->m_sFilename);
m_pOfficeDrawingConverter->SaveDstContentRels(sRelsPath);
long rId;
......@@ -2834,7 +2834,7 @@ namespace BinXlsxRW {
res = Read1(length, &BinaryOtherTableReader::ReadMediaContent, this, poResult);
else if(c_oSer_OtherType::Theme == type)
{
CString sThemePath;sThemePath.Format(_T("%s\\%s"), m_oSaveParams.sThemePath, OOX::FileTypes::Theme.DefaultFileName().GetPath());
CString sThemePath;sThemePath.Format(_T("%s/%s"), m_oSaveParams.sThemePath, OOX::FileTypes::Theme.DefaultFileName().GetPath());
long nCurPos = m_oBufferedStream.GetPos();
m_pOfficeDrawingConverter->SaveThemeXml(nCurPos, length, sThemePath);
m_oBufferedStream.Seek(nCurPos + length);
......@@ -2894,7 +2894,7 @@ namespace BinXlsxRW {
else
{
//local
sImageSrc = m_sFileInDir + _T("media\\") + sImage;
sImageSrc = m_sFileInDir + _T("media/") + sImage;
}
}
//
......@@ -2925,7 +2925,7 @@ namespace BinXlsxRW {
CString sNewImageName;
sNewImageName.Format(_T("image%d%s"), m_nCurIndex, OOX::CPath(sTempPath).GetExtention(true));
m_nCurIndex++;
CString sNewImagePath = m_sMediaDir + _T("\\") + sNewImageName;
CString sNewImagePath = m_sMediaDir + FILE_SEPARATOR_STR + sNewImageName;
return sNewImagePath;
}
void ReadMediaItemSaveFileFILE(FILE* pFile)
......@@ -3042,7 +3042,7 @@ namespace BinXlsxRW {
sDstPath += _T("Temp");
OOX::Spreadsheet::CXlsx oXlsx;
SaveParams oSaveParams(sDstPath + _T("\\") + OOX::Spreadsheet::FileTypes::Workbook.DefaultDirectory().GetPath() + _T("\\") + OOX::FileTypes::Theme.DefaultDirectory().GetPath());
SaveParams oSaveParams(sDstPath + _T("/") + OOX::Spreadsheet::FileTypes::Workbook.DefaultDirectory().GetPath() + _T("/") + OOX::FileTypes::Theme.DefaultDirectory().GetPath());
ReadMainTable(oXlsx, oBufferedStream, OOX::CPath(sSrcFileName).GetDirectory(), sDstPath, oSaveParams, pOfficeDrawingConverter);
CString sAdditionalContentTypes = oSaveParams.sAdditionalContentTypes;
if(NULL != pOfficeDrawingConverter)
......@@ -3101,7 +3101,7 @@ namespace BinXlsxRW {
aOffBits.push_back(mtiOffBits);
}
}
CString sMediaDir = sOutDir + _T("\\xl\\media");
CString sMediaDir = sOutDir + _T("/xl/media");
std::map<long, ImageObject*> mapMedia;
if(-1 != nOtherOffBits)
{
......@@ -3162,4 +3162,4 @@ namespace BinXlsxRW {
}
};
};
#endif // #ifndef BINARY_READER
\ No newline at end of file
#endif // #ifndef BINARY_READER
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