4 #include <wx/tokenzr.h>
6 void ExportVCard4(bool DirMode, wxString OutputLocation, wxArrayString *FileList, int *ExportCount){
10 // Output each contact into the directory.
12 // Simply just copy the files unchanged.
15 wxString FinalFilename;
17 for (int i = 0; i < FileList->GetCount(); i++){
19 // Get the final part of the path (filename).
21 #if defined(__HAIKU__)
24 #elif defined(__WIN32__)
26 wxStringTokenizer FileToken(FileList->Item(i), wxT("//"));
28 while (FileToken.HasMoreTokens()){
29 Filename = FileToken.GetNextToken();
32 // Copy the file to the requested directory.
34 FinalFilename.Append(OutputLocation);
35 FinalFilename.Append(wxT("/"));
36 FinalFilename.Append(Filename);
40 wxStringTokenizer FileToken(FileList->Item(i), wxT("//"));
42 while(FileToken.HasMoreTokens()){
43 Filename = FileToken.GetNextToken();
46 // Copy the file to the requested directory.
48 FinalFilename.Append(OutputLocation);
49 FinalFilename.Append(wxT("/"));
50 FinalFilename.Append(Filename);
54 bool CopyResult = wxCopyFile(FileList->Item(i), FinalFilename);
59 FinalFilename.Clear();
65 // Output all contacts into one file.
70 // Open the output file.
72 #if wxABI_VERSION < 20900
73 OutputFile.Open(OutputLocation.c_str(), wxT("w"));
75 OutputFile.Open(OutputLocation, wxT("w"));
78 wxString InputFileData;
80 for (int i = 0; i < FileList->GetCount(); i++){
82 // Open up the input file.
84 InputFile.Open(FileList->Item(i), wxT("r"));
86 InputFile.ReadAll(&InputFileData, wxConvAuto());
88 OutputFile.Write(InputFileData, wxConvAuto());
91 InputFileData.Clear();