Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need some help with the following coding

 
Dan Czarnecki
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again everyone!

It's been awhile since I've been here!

I have a problem with my directory processor class that I cannot figure out how to fix it.

Below is my code:


The problem I'm having is that when displaying the number of files in a directory and the total directory size, they just show up as zeros.

Anyone know what I should do to get this working?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're creating a new DirectoryStatistics object for each file instead of just a single one.
 
Dan Czarnecki
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You're creating a new DirectoryStatistics object for each file instead of just a single one.


Ok. Since you're saying I should just just be creating a single DirectoryStatistics object for the directory itself instead for each file in the directory, how would I go about doing that?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possibly by creating it in the main method, and then passing it to DirectorySize as a parameter of the constructor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic