1

Closed

SetupChannel Bug - string.Format and File.Exists incorrect.

description

First, thanks for the headstart on this library. Very handy for this fun home project I am doing.

My feedback so far:

2 bugs in SetupChannel method:

1.)
var outputName = string.Format("gpio{0}", CultureInfo.InvariantCulture, (int)pinNumber);

The {0} refers to the first parameter, not the pinNumber. Remove the InvariantCulture, so the gpio parameter will be in the string.

Easy fix, but took me putting the code in my own library to figure that out.

2.)

if (File.Exists(gpioPath))
{
{

the gpioPath is actually a directory, not a file, so that condition will never be hit.

should be:

if (Directory.Exists(gpioPath))
{
}

Once I changed both of those, all my issues went away and the GPIO started working correctly for me.

Thanks again for this. Helped me understand how GPIO worked with RP!
Closed Mar 12, 2015 at 1:11 AM by andycb

comments

andycb wrote Mar 12, 2015 at 1:11 AM

Thanks for the feedback. This is now added.

wrote Mar 12, 2015 at 1:11 AM