Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions dotnet/src/dotnetframework/GxClasses/Domain/GXFileIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public void MoveTo(string desDirName)
}
public class GxFileInfo : IGxFileInfo
{
private static readonly ILog log = log4net.LogManager.GetLogger(typeof(GxFileInfo));
FileInfo _file;
string _baseDirectory;

Expand Down Expand Up @@ -309,10 +310,16 @@ public string Separator
public IGxFileInfo CopyTo(string filename, bool overwrite)
{
filename = FileUtil.NormalizeSource(filename, _baseDirectory);

FileInfo targetFile = new FileInfo(filename);
if (!targetFile.Directory.Exists)
targetFile.Directory.Create();
try
{
FileInfo targetFile = new FileInfo(filename);
if (targetFile.Directory!=null && !targetFile.Directory.Exists)
targetFile.Directory.Create();
}
catch (Exception ex)
{
GXLogging.Error(log, ex, "Error creating target directory for ", filename);
}

return new GxFileInfo(_file.CopyTo(filename, overwrite));
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/DotNetCoreUnitTest/DotNetCoreUnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\DotNetUnitTest\ConfigMappings\ConfigTest.cs" Link="ConfigMappings\ConfigTest.cs" />
<Compile Include="..\DotNetUnitTest\FileIO\DfrgFunctions.cs" Link="FileIO\DfrgFunctions.cs" />
<Compile Include="..\DotNetUnitTest\FileIO\DfrgFunctions.cs" Link="FileIO\DfrgFunctions.cs" />
<Compile Include="..\DotNetUnitTest\FileIO\Xslt.cs" Link="FileIO\Xslt.cs" />
<Compile Include="..\DotNetUnitTest\ExternalProvider\ExternalProviderS3Test.cs" Link="ExternalProvider\ExternalProviderS3Test.cs" />
<Compile Include="..\DotNetUnitTest\ExternalProvider\ExternalProviderS3PrivateTest.cs" Link="ExternalProvider\ExternalProviderS3PrivateTest.cs" />
Expand Down
10 changes: 10 additions & 0 deletions dotnet/test/DotNetUnitTest/FileIO/FileIOTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ public FileIOTests()
Config.ConfigFileName = "client.exe.config";
}
[Fact]
public void FileSharedToCopy()
{
string target = @"\\192.168.86.3\printer";
GxFile f = new GxFile();
f.Source = "Document.txt";
f.Copy(target);
Assert.Equal(-1, f.ErrCode);
Assert.NotEqual(new NullReferenceException().Message, f.ErrDescription);
}
[Fact]
public void FileSourceTest()
{
GxFileInfo fi = new GxFileInfo(string.Empty);
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/DotNetUnitTest/PDF/apdfbasictest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void executePrivate( )
getPrinter().GxDrawText("Name", 183, Gx_line+83, 283, Gx_line+101, 0, 0, 0, 0) ;
getPrinter().GxDrawBitMap("lamp.png", 411, Gx_line+33, 619, Gx_line+241) ;
getPrinter().GxAttris("Microsoft Sans Serif", 8, false, false, false, false, 0, 0, 0, 0, 0, 255, 255, 255) ;
getPrinter().GxDrawText(StringUtil.RTrim( context.localUtil.Format( AV8htmlvar, "")), 22, Gx_line+122, 400, Gx_line+178, 0, 1, 0, 0) ;
getPrinter().GxDrawText(StringUtil.RTrim( AV8htmlvar), 22, Gx_line+122, 400, Gx_line+178, 0, 1, 0, 0) ;
Gx_OldLine = Gx_line;
Gx_line = (int)(Gx_line+193);
/* Print footer for last page */
Expand Down