Fixed battery widget opening missing file #1

Merged
ashpie merged 2 commits from lucastarche/simple-awesome:develop into develop 2021-07-04 16:25:22 +02:00
Contributor

Some models of batteries (like mine, hence this PR), have no files named "energy_now" nor "energy_full", but do have "charge_now" and "charge_full".

It adds a check to see whether the file exists or not, and uses the appropiate files

It should work but as I have no way to check if it works with batteries with "energy_now"

Some models of batteries (like mine, hence this PR), have no files named "energy_now" nor "energy_full", but do have "charge_now" and "charge_full". It adds a check to see whether the file exists or not, and uses the appropiate files It *should* work but as I have no way to check if it works with batteries with "energy_now"
lucastarche added 1 commit 2021-07-03 21:49:46 +02:00
Owner

Hi, thanks a lot for this pull request. Do you mind to instead of using the cat shell command, add and use this function? :

function file_exists(name)
	local f = io.open(name,"r")
	if f ~= nil then
		io.close(f)
		return true
	else
		return false
	end
end

You don't have to replace everything in this file, I think it'd just be a better practice to try and use the io library asap.

Hi, thanks a lot for this pull request. Do you mind to instead of using the `cat` shell command, add and use this function? : ```lua function file_exists(name) local f = io.open(name,"r") if f ~= nil then io.close(f) return true else return false end end ``` You don't have to replace everything in this file, I think it'd just be a better practice to try and use the io library asap.
lucastarche added 1 commit 2021-07-04 15:12:03 +02:00
Author
Contributor

This should implement the changes, although do tell me if you need me to change something else.

This should implement the changes, although do tell me if you need me to change something else.
Owner

Seems good, thanks so much for your contribution! <3

Seems good, thanks so much for your contribution! <3
ashpie merged commit e36d42dfeb into develop 2021-07-04 16:25:22 +02:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ashpie/simple-awesome#1
No description provided.