From: Mike G. v. a. <we...@ma...> - 2005-09-09 20:50:43
|
Log Message: ----------- Fixed a bug in which, if the Hardcopy call was the first one to need to create the directory at (e.g.) /ww/htdocs/tmp/myCourse then the creation of myCourse would fail. If /ww/htdocs/tmp/myCourse/gif already existed things would go fine. I think that more has to be done here. We need to look at how myCourse is created when storing a gif or html is the first action and handle these all the same. One of the difficulties is that the tmp directory might be located anywhere -- it is not guaranteed to be under /ww/webwork/webwork2/htdocs -- at least as we have defined it at the moment. Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: Hardcopy.pm Revision Data ------------- Index: Hardcopy.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Hardcopy.pm,v retrieving revision 1.59 retrieving revision 1.60 diff -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -u -r1.59 -r1.60 --- lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -45,7 +45,7 @@ use WeBWorK::Form; use WeBWorK::Debug; use WeBWorK::PG; -use WeBWorK::Utils qw(readFile makeTempDirectory); +use WeBWorK::Utils qw(readFile makeTempDirectory surePathToFile); use Apache::Constants qw(:common REDIRECT); =head1 CONFIGURATION VARIABLES @@ -472,9 +472,14 @@ # Location for hardcopy file to be downloaded # FIXME this should use surePathToTmpFile - my $hardcopyTempDirectory = $ce->{courseDirs}->{html_temp}."/hardcopy"; - mkdir ($hardcopyTempDirectory) or die "Unable to make $hardcopyTempDirectory" unless -e $hardcopyTempDirectory; - my $hardcopyFilePath = "$hardcopyTempDirectory/$TeXdownloadFileName"; + # The html_temp directory might not have been created. + # But since the temp directory might be located anywhere we don't know what to use + # for the start file. + mkdir ($ce->{courseDirs}->{html_temp}) or die "Unable to make directory: ".$ce->{courseDirs}->{html_temp} + unless -e $ce->{courseDirs}->{html_temp}; + my $hardcopyTempDirectory = $ce->{courseDirs}->{html_temp}."/hardcopy"; + my $hardcopyFilePath = surePathToFile($ce->{courseDirs}->{html_temp}, "$hardcopyTempDirectory/$fileName"); + my $hardcopyFileURL = $ce->{courseURLs}->{html_temp}."/hardcopy/$TeXdownloadFileName"; $self->{hardcopyFilePath} = $hardcopyFilePath; $self->{hardcopyFileURL} = $hardcopyFileURL; @@ -517,13 +522,20 @@ my $r = $self->r; my $ce = $r->ce; + #FIXME is $tempDir used? #my $finalFile = "$tempDir/$fileName"; # Location for hardcopy file to be downloaded # FIXME this should use surePathToTmpFile - my $hardcopyTempDirectory = $ce->{courseDirs}->{html_temp}."/hardcopy"; - mkdir ($hardcopyTempDirectory) or die "Unable to make $hardcopyTempDirectory" unless -e $hardcopyTempDirectory; - my $hardcopyFilePath = "$hardcopyTempDirectory/$fileName"; + # The html_temp directory might not have been created. + # But since the temp directory might be located anywhere we don't know what to use + # for the start file. + mkdir ($ce->{courseDirs}->{html_temp}) or die "Unable to make directory: ".$ce->{courseDirs}->{html_temp} + unless -e $ce->{courseDirs}->{html_temp}; + my $hardcopyTempDirectory = $ce->{courseDirs}->{html_temp}."/hardcopy"; + my $hardcopyFilePath = surePathToFile($ce->{courseDirs}->{html_temp}, "$hardcopyTempDirectory/$fileName"); + + my $hardcopyFileURL = $ce->{courseURLs}->{html_temp}."/hardcopy/$fileName"; $self->{hardcopyFilePath} = $hardcopyFilePath; $self->{hardcopyFileURL} = $hardcopyFileURL; |